smbfs 1.69 (13.6.2005)

- The time stamps used in "proc.c", as returned and submitted to
  the SMB file system on the other end of the wire are apparently
  all in Universally Coordinated Time already (or at least, this
  seems to be the case with Samba and Windows XP). Hence no conversion
  between local time and UTC is necessary, which would otherwise
  distort all date stamps converted. I modified the file system to
  leave all time stamps essentially unadjusted for local time in
  "proc.c". The local time zone adjustments are now performed only
  where the time in question is known to be Amiga-specific, such as
  the current system time or the date stamp to set for a file.

  The time conversion appears to be working correctly now, but it
  does ignore the effects of daylight savings time, which you might
  want to adjust for manually through the TIMEZONEOFFSET option
  (careful though: this overrides your current locale-defined time
  zone settings as far as smbfs is concerned).

  Unsolved problem: at least Windows XP seems to return different
  time stamps for directory listings and for indidivual files. As
  far as I can tell, the sets of time stamps returned for either
  doesn't match anywhere.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/amiga-smbfs/trunk@13 26594b9e-b914-4e86-b7a1-9402bd427170
This commit is contained in:
Olaf Barthel
2005-06-13 08:04:29 +00:00
parent 1566796e21
commit 78e86b738f
6 changed files with 84 additions and 55 deletions
+5 -7
View File
@@ -1,5 +1,5 @@
/*
* $Id: main.c,v 1.3 2005-05-29 08:32:58 obarthel Exp $
* $Id: main.c,v 1.4 2005-06-13 08:04:15 obarthel Exp $
*
* :ts=4
*
@@ -129,7 +129,7 @@ VOID FreeMemory(APTR address);
APTR AllocateMemory(ULONG size);
LONG GetTimeZoneDelta(VOID);
ULONG GetCurrentTime(VOID);
VOID LocalTime(time_t seconds, struct tm *tm);
VOID GMTime(time_t seconds, struct tm *tm);
time_t MakeTime(const struct tm *const tm);
VOID VARARGS68K SPrintf(STRPTR buffer, STRPTR formatString, ...);
int BroadcastNameQuery(char *name, char *scope, UBYTE *address);
@@ -1162,12 +1162,10 @@ GetCurrentTime(VOID)
* in Unix format.
*/
VOID
LocalTime(time_t seconds,struct tm * tm)
GMTime(time_t seconds,struct tm * tm)
{
struct ClockData clock_data;
seconds -= GetTimeZoneDelta();
if(seconds < UNIX_TIME_OFFSET)
seconds = 0;
else
@@ -1201,7 +1199,7 @@ MakeTime(const struct tm * const tm)
clock_data.month = tm->tm_mon + 1;
clock_data.year = tm->tm_year + 1900;
seconds = Date2Amiga(&clock_data) + UNIX_TIME_OFFSET + GetTimeZoneDelta();
seconds = Date2Amiga(&clock_data) + UNIX_TIME_OFFSET;
return(seconds);
}
@@ -5109,7 +5107,7 @@ Action_SetDate(
st.atime = -1;
st.ctime = -1;
st.mtime = UNIX_TIME_OFFSET + seconds + GetTimeZoneDelta();
st.mtime = seconds + UNIX_TIME_OFFSET + GetTimeZoneDelta();
st.size = -1;
error = smba_setattr(file,&st);
+46 -40
View File
@@ -1,5 +1,5 @@
/*
* $Id: proc.c,v 1.3 2005-06-03 14:34:17 obarthel Exp $
* $Id: proc.c,v 1.4 2005-06-13 08:04:15 obarthel Exp $
*
* :ts=8
*
@@ -37,8 +37,6 @@
static INLINE byte * smb_encode_word(byte *p, word data);
static INLINE byte * smb_decode_word(byte *p, word *data);
static INLINE int utc2local(int time_value);
static INLINE int local2utc(int time_value);
static INLINE word smb_bcc(byte *packet);
static INLINE int smb_verify(byte *packet, int command, int wct, int bcc);
static byte *smb_encode_dialect(byte *p, const byte *name, int len);
@@ -173,6 +171,13 @@ smb_name_mangle (byte * p, const byte * name)
return p;
}
/* Apparently, the time values used here are already relative
to UTC and not in the local time zone. Hence the dummy
macros and the commented-out conversion functions. */
#define utc2local(time_value) (time_value)
#define local2utc(time_value) (time_value)
/*
static INLINE int
utc2local (int time_value)
{
@@ -192,6 +197,7 @@ local2utc (int time_value)
return result;
}
*/
/* Convert a MS-DOS time/date pair to a UNIX date (seconds since January 1st 1970). */
static int
@@ -220,7 +226,7 @@ date_unix2dos (int unix_date, unsigned short *time_value, unsigned short *date)
{
struct tm tm;
LocalTime(unix_date,&tm);
GMTime(unix_date,&tm);
(*time_value) = (tm.tm_hour << 11) | (tm.tm_min << 5) | (tm.tm_sec / 2);
(*date) = ((tm.tm_year - 80) << 9) | ((tm.tm_mon + 1) << 5) | tm.tm_mday;
@@ -631,16 +637,16 @@ smb_proc_open (struct smb_server *server, const char *pathname, int len, struct
{
struct tm tm;
LocalTime(entry->ctime,&tm);
GMTime(entry->ctime,&tm);
LOG(("ctime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(entry->atime,&tm);
GMTime(entry->atime,&tm);
LOG(("atime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(entry->mtime,&tm);
GMTime(entry->mtime,&tm);
LOG(("mtime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(entry->wtime,&tm);
GMTime(entry->wtime,&tm);
LOG(("wtime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
}
#endif /* DEBUG */
@@ -1095,16 +1101,16 @@ smb_decode_dirent (char *p, struct smb_dirent *entry)
{
struct tm tm;
LocalTime(entry->ctime,&tm);
GMTime(entry->ctime,&tm);
LOG(("ctime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(entry->atime,&tm);
GMTime(entry->atime,&tm);
LOG(("atime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(entry->mtime,&tm);
GMTime(entry->mtime,&tm);
LOG(("mtime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(entry->wtime,&tm);
GMTime(entry->wtime,&tm);
LOG(("wtime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
}
#endif /* DEBUG */
@@ -1374,16 +1380,16 @@ smb_decode_long_dirent (char *p, struct smb_dirent *finfo, int level)
{
struct tm tm;
LocalTime(finfo->ctime,&tm);
GMTime(finfo->ctime,&tm);
LOG(("ctime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(finfo->atime,&tm);
GMTime(finfo->atime,&tm);
LOG(("atime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(finfo->mtime,&tm);
GMTime(finfo->mtime,&tm);
LOG(("mtime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(finfo->wtime,&tm);
GMTime(finfo->wtime,&tm);
LOG(("wtime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
}
#endif /* DEBUG */
@@ -1421,16 +1427,16 @@ smb_decode_long_dirent (char *p, struct smb_dirent *finfo, int level)
{
struct tm tm;
LocalTime(finfo->ctime,&tm);
GMTime(finfo->ctime,&tm);
LOG(("ctime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(finfo->atime,&tm);
GMTime(finfo->atime,&tm);
LOG(("atime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(finfo->mtime,&tm);
GMTime(finfo->mtime,&tm);
LOG(("mtime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(finfo->wtime,&tm);
GMTime(finfo->wtime,&tm);
LOG(("wtime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
}
#endif /* DEBUG */
@@ -1457,16 +1463,16 @@ smb_decode_long_dirent (char *p, struct smb_dirent *finfo, int level)
{
struct tm tm;
LocalTime(finfo->ctime,&tm);
GMTime(finfo->ctime,&tm);
LOG(("ctime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(finfo->atime,&tm);
GMTime(finfo->atime,&tm);
LOG(("atime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(finfo->mtime,&tm);
GMTime(finfo->mtime,&tm);
LOG(("mtime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(finfo->wtime,&tm);
GMTime(finfo->wtime,&tm);
LOG(("wtime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
}
#endif /* DEBUG */
@@ -1492,16 +1498,16 @@ smb_decode_long_dirent (char *p, struct smb_dirent *finfo, int level)
{
struct tm tm;
LocalTime(finfo->ctime,&tm);
GMTime(finfo->ctime,&tm);
LOG(("ctime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(finfo->atime,&tm);
GMTime(finfo->atime,&tm);
LOG(("atime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(finfo->mtime,&tm);
GMTime(finfo->mtime,&tm);
LOG(("mtime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(finfo->wtime,&tm);
GMTime(finfo->wtime,&tm);
LOG(("wtime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
}
#endif /* DEBUG */
@@ -1569,16 +1575,16 @@ smb_decode_long_dirent (char *p, struct smb_dirent *finfo, int level)
{
struct tm tm;
LocalTime(finfo->ctime,&tm);
GMTime(finfo->ctime,&tm);
LOG(("ctime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(finfo->atime,&tm);
GMTime(finfo->atime,&tm);
LOG(("atime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(finfo->wtime,&tm);
GMTime(finfo->wtime,&tm);
LOG(("wtime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(finfo->mtime,&tm);
GMTime(finfo->mtime,&tm);
LOG(("mtime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
}
#endif /* DEBUG */
@@ -1977,16 +1983,16 @@ smb_proc_getattr_core (struct smb_server *server, const char *path, int len, str
{
struct tm tm;
LocalTime(entry->ctime,&tm);
GMTime(entry->ctime,&tm);
LOG(("ctime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(entry->atime,&tm);
GMTime(entry->atime,&tm);
LOG(("atime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(entry->mtime,&tm);
GMTime(entry->mtime,&tm);
LOG(("mtime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(entry->wtime,&tm);
GMTime(entry->wtime,&tm);
LOG(("wtime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
}
#endif /* DEBUG */
@@ -2020,16 +2026,16 @@ smb_proc_getattrE (struct smb_server *server, struct smb_dirent *entry)
{
struct tm tm;
LocalTime(entry->ctime,&tm);
GMTime(entry->ctime,&tm);
LOG(("ctime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(entry->atime,&tm);
GMTime(entry->atime,&tm);
LOG(("atime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(entry->mtime,&tm);
GMTime(entry->mtime,&tm);
LOG(("mtime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
LocalTime(entry->wtime,&tm);
GMTime(entry->wtime,&tm);
LOG(("wtime = %ld-%02ld-%02ld %ld:%02ld:%02ld\n",tm.tm_year + 1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec));
}
#endif /* DEBUG */
+2 -2
View File
@@ -1,5 +1,5 @@
/*
* $Id: smbfs.h,v 1.2 2005-05-27 09:48:26 obarthel Exp $
* $Id: smbfs.h,v 1.3 2005-06-13 08:04:15 obarthel Exp $
*
* :ts=4
*
@@ -126,7 +126,7 @@ extern STRPTR amitcp_strerror(int error);
extern STRPTR host_strerror(int error);
extern time_t MakeTime(const struct tm * const tm);
extern ULONG GetCurrentTime(VOID);
extern VOID LocalTime(time_t seconds,struct tm * tm);
extern VOID GMTime(time_t seconds,struct tm * tm);
extern VOID VARARGS68K ReportError(STRPTR fmt,...);
extern VOID StringToUpper(STRPTR s);
extern VOID VARARGS68K SPrintf(STRPTR buffer, STRPTR formatString,...);
+5 -5
View File
@@ -1,6 +1,6 @@
#define VERSION 1
#define REVISION 68
#define DATE "3.6.2005"
#define VERS "smbfs 1.68"
#define VSTRING "smbfs 1.68 (3.6.2005)\r\n"
#define VERSTAG "\0$VER: smbfs 1.68 (3.6.2005)"
#define REVISION 69
#define DATE "13.6.2005"
#define VERS "smbfs 1.69"
#define VSTRING "smbfs 1.69 (13.6.2005)\r\n"
#define VERSTAG "\0$VER: smbfs 1.69 (13.6.2005)"
+1 -1
View File
@@ -1 +1 @@
68
69