From 2beada804a238534628398f62fe4ed9e8d2c3efd Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 13 Feb 1998 07:11:58 +0000 Subject: Ding-dong the witch is dead, the witch is dead...... This is the checkin that fixes the infamous Visual C++ 'file has changed' bug. I feel *SO* good about that :-). charset.c: Added (void) to fix Herb's fussy compiler. loadparm.c: Removed "win95 bug compatibility" (didn't like it much anyway :-). Added "dos filetime resolution" instead. reply.c: Added the 2 second timestamp resolution fix that the song above is about. time.c: Removed unneeded get_access_time() function. trans2.c : Removed unneeded "win95 bug compatibility" code. Jeremy. (This used to be commit 10d628e4aeaecc573de27e251fec7b91844cba40) --- source3/include/proto.h | 5 ++--- source3/include/version.h | 2 +- source3/lib/charset.c | 2 +- source3/lib/time.c | 14 -------------- source3/param/loadparm.c | 8 ++++---- source3/smbd/reply.c | 17 +++++++++++++---- source3/smbd/trans2.c | 26 ++++++++------------------ 7 files changed, 29 insertions(+), 45 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index 306d3a42a0..97017e77b0 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -36,7 +36,7 @@ void interpret_character_set(char *str); /*The following definitions come from charset.c */ -void charset_initialise(); +void charset_initialise(void); void codepage_initialise(int client_codepage); void add_char_string(char *s); @@ -280,7 +280,6 @@ BOOL lp_nis_home_map(void); BOOL lp_time_server(void); BOOL lp_bind_interfaces_only(void); BOOL lp_net_wksta_user_logon(void); -BOOL lp_win95_bug_compatibility(void); int lp_os_level(void); int lp_max_ttl(void); int lp_max_wins_ttl(void); @@ -370,6 +369,7 @@ BOOL lp_delete_readonly(int ); BOOL lp_fake_oplocks(int ); BOOL lp_recursive_veto_delete(int ); BOOL lp_dos_filetimes(int ); +BOOL lp_dos_filetime_resolution(int ); int lp_create_mode(int ); int lp_force_create_mode(int ); int lp_dir_mode(int ); @@ -1342,7 +1342,6 @@ time_t make_unix_date2(void *date_ptr); time_t make_unix_date3(void *date_ptr); char *timestring(void ); time_t get_create_time(struct stat *st); -time_t get_access_time(struct stat *st); /*The following definitions come from trans2.c */ diff --git a/source3/include/version.h b/source3/include/version.h index 2b6537a173..758b32209e 100644 --- a/source3/include/version.h +++ b/source3/include/version.h @@ -1 +1 @@ -#define VERSION "1.9.18" +#define VERSION "1.9.18-HEAD" diff --git a/source3/lib/charset.c b/source3/lib/charset.c index 74e3a8f358..79a82f8587 100644 --- a/source3/lib/charset.c +++ b/source3/lib/charset.c @@ -145,7 +145,7 @@ static void add_dos_char(int lower, BOOL map_lower_to_upper, /**************************************************************************** initialise the charset arrays ****************************************************************************/ -void charset_initialise() +void charset_initialise(void) { int i; diff --git a/source3/lib/time.c b/source3/lib/time.c index 81e3dcfd8f..f60af60c7a 100644 --- a/source3/lib/time.c +++ b/source3/lib/time.c @@ -499,17 +499,3 @@ time_t get_create_time(struct stat *st) */ return ret; } - -/**************************************************************************** - return the 'access time' under UNIX from a stat structure. - This function exists to allow modifications to be done depending - on what we want to return. Just return the normal atime (for now). -****************************************************************************/ - -time_t get_access_time(struct stat *st) -{ - if (lp_win95_bug_compatibility()) - return st->st_mtime; - else - return st->st_atime; -} diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 82a4851444..0bb2056745 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -189,7 +189,6 @@ typedef struct BOOL bTimeServer; BOOL bBindInterfacesOnly; BOOL bNetWkstaUserLogon; - BOOL bWin95BugCompatibility; } global; static global Globals; @@ -280,6 +279,7 @@ typedef struct BOOL bFakeOplocks; BOOL bDeleteVetoFiles; BOOL bDosFiletimes; + BOOL bDosFiletimeResolution; char dummy[3]; /* for alignment */ } service; @@ -366,6 +366,7 @@ static service sDefault = False, /* bFakeOplocks */ False, /* bDeleteVetoFiles */ False, /* bDosFiletimes */ + False, /* bDosFiletimeResolution */ "" /* dummy */ }; @@ -531,7 +532,6 @@ static struct parm_struct {"unix realname", P_BOOL, P_GLOBAL, &Globals.bUnixRealname, NULL, NULL}, {"NIS homedir", P_BOOL, P_GLOBAL, &Globals.bNISHomeMap, NULL, NULL}, {"time server", P_BOOL, P_GLOBAL, &Globals.bTimeServer, NULL, NULL}, - {"win95 bug compatibility", P_BOOL, P_GLOBAL, &Globals.bWin95BugCompatibility,NULL, NULL}, {"printer driver file", P_STRING, P_GLOBAL, &Globals.szDriverFile, NULL, NULL}, {"-valid", P_BOOL, P_LOCAL, &sDefault.valid, NULL, NULL}, {"comment", P_STRING, P_LOCAL, &sDefault.comment, NULL, NULL}, @@ -628,6 +628,7 @@ static struct parm_struct {"mangled map", P_STRING, P_LOCAL, &sDefault.szMangledMap, NULL, NULL}, {"delete readonly", P_BOOL, P_LOCAL, &sDefault.bDeleteReadonly, NULL, NULL}, {"dos filetimes", P_BOOL, P_LOCAL, &sDefault.bDosFiletimes, NULL, NULL}, + {"dos filetime resolution", P_BOOL, P_LOCAL, &sDefault.bDosFiletimeResolution, NULL, NULL}, {NULL, P_BOOL, P_NONE, NULL, NULL, NULL} }; @@ -725,7 +726,6 @@ static void init_globals(void) Globals.bTimeServer = False; Globals.bBindInterfacesOnly = False; Globals.bNetWkstaUserLogon = True; - Globals.bWin95BugCompatibility = False; /* these parameters are set to defaults that are more appropriate for the increasing samba install base: @@ -942,7 +942,6 @@ FN_GLOBAL_BOOL(lp_nis_home_map,&Globals.bNISHomeMap) FN_GLOBAL_BOOL(lp_time_server,&Globals.bTimeServer) FN_GLOBAL_BOOL(lp_bind_interfaces_only,&Globals.bBindInterfacesOnly) FN_GLOBAL_BOOL(lp_net_wksta_user_logon,&Globals.bNetWkstaUserLogon) -FN_GLOBAL_BOOL(lp_win95_bug_compatibility,&Globals.bWin95BugCompatibility) FN_GLOBAL_INTEGER(lp_os_level,&Globals.os_level) FN_GLOBAL_INTEGER(lp_max_ttl,&Globals.max_ttl) @@ -1035,6 +1034,7 @@ FN_LOCAL_BOOL(lp_delete_readonly,bDeleteReadonly) FN_LOCAL_BOOL(lp_fake_oplocks,bFakeOplocks) FN_LOCAL_BOOL(lp_recursive_veto_delete,bDeleteVetoFiles) FN_LOCAL_BOOL(lp_dos_filetimes,bDosFiletimes) +FN_LOCAL_BOOL(lp_dos_filetime_resolution,bDosFiletimeResolution) FN_LOCAL_INTEGER(lp_create_mode,iCreate_mask) FN_LOCAL_INTEGER(lp_force_create_mode,iCreate_force_mode) diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 93bb679289..38380180f9 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -779,7 +779,10 @@ int reply_getatr(char *inbuf,char *outbuf) outsize = set_message(outbuf,10,0,True); SSVAL(outbuf,smb_vwv0,mode); - put_dos_date3(outbuf,smb_vwv1,mtime); + if(lp_dos_filetime_resolution(SNUM(cnum)) ) + put_dos_date3(outbuf,smb_vwv1,mtime & ~1); + else + put_dos_date3(outbuf,smb_vwv1,mtime); SIVAL(outbuf,smb_vwv3,size); if (Protocol >= PROTOCOL_NT1) { @@ -1231,7 +1234,10 @@ int reply_open(char *inbuf,char *outbuf) outsize = set_message(outbuf,7,0,True); SSVAL(outbuf,smb_vwv0,fnum); SSVAL(outbuf,smb_vwv1,fmode); - put_dos_date3(outbuf,smb_vwv2,mtime); + if(lp_dos_filetime_resolution(SNUM(cnum)) ) + put_dos_date3(outbuf,smb_vwv2,mtime & ~1); + else + put_dos_date3(outbuf,smb_vwv2,mtime); SIVAL(outbuf,smb_vwv4,size); SSVAL(outbuf,smb_vwv6,rmode); @@ -1357,7 +1363,10 @@ int reply_open_and_X(char *inbuf,char *outbuf,int length,int bufsize) set_message(outbuf,15,0,True); SSVAL(outbuf,smb_vwv2,fnum); SSVAL(outbuf,smb_vwv3,fmode); - put_dos_date3(outbuf,smb_vwv4,mtime); + if(lp_dos_filetime_resolution(SNUM(cnum)) ) + put_dos_date3(outbuf,smb_vwv4,mtime & ~1); + else + put_dos_date3(outbuf,smb_vwv4,mtime); SIVAL(outbuf,smb_vwv6,size); SSVAL(outbuf,smb_vwv8,rmode); SSVAL(outbuf,smb_vwv11,smb_action); @@ -3917,7 +3926,7 @@ int reply_getattrE(char *inbuf,char *outbuf) date to be last modify date as UNIX doesn't save this */ put_dos_date2(outbuf,smb_vwv0,get_create_time(&sbuf)); - put_dos_date2(outbuf,smb_vwv2,get_access_time(&sbuf)); + put_dos_date2(outbuf,smb_vwv2,sbuf.st_atime); put_dos_date2(outbuf,smb_vwv4,sbuf.st_mtime); if (mode & aDIR) { diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 2b5d5785fa..6eda891e32 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -376,7 +376,7 @@ static int get_lanman2_dir_entry(int cnum,char *path_mask,int dirtype,int info_l size = sbuf.st_size; mdate = sbuf.st_mtime; - adate = get_access_time(&sbuf); + adate = sbuf.st_atime; cdate = get_create_time(&sbuf); if(mode & aDIR) size = 0; @@ -1139,18 +1139,9 @@ static int call_trans2qfilepathinfo(char *inbuf, char *outbuf, int length, case SMB_INFO_STANDARD: case SMB_INFO_QUERY_EA_SIZE: data_size = (info_level==1?22:26); - if( lp_win95_bug_compatibility()) - { - put_dos_date(pdata,l1_fdateCreation,get_create_time(&sbuf)); - put_dos_date(pdata,l1_fdateLastAccess,get_access_time(&sbuf)); - put_dos_date(pdata,l1_fdateLastWrite,sbuf.st_mtime); /* write time */ - } - else - { - put_dos_date2(pdata,l1_fdateCreation,get_create_time(&sbuf)); - put_dos_date2(pdata,l1_fdateLastAccess,get_access_time(&sbuf)); - put_dos_date2(pdata,l1_fdateLastWrite,sbuf.st_mtime); /* write time */ - } + put_dos_date2(pdata,l1_fdateCreation,get_create_time(&sbuf)); + put_dos_date2(pdata,l1_fdateLastAccess,sbuf.st_atime); + put_dos_date2(pdata,l1_fdateLastWrite,sbuf.st_mtime); /* write time */ SIVAL(pdata,l1_cbFile,size); SIVAL(pdata,l1_cbFileAlloc,ROUNDUP(size,1024)); SSVAL(pdata,l1_attrFile,mode); @@ -1160,7 +1151,7 @@ static int call_trans2qfilepathinfo(char *inbuf, char *outbuf, int length, case SMB_INFO_QUERY_EAS_FROM_LIST: data_size = 24; put_dos_date2(pdata,0,get_create_time(&sbuf)); - put_dos_date2(pdata,4,get_access_time(&sbuf)); + put_dos_date2(pdata,4,sbuf.st_atime); put_dos_date2(pdata,8,sbuf.st_mtime); SIVAL(pdata,12,size); SIVAL(pdata,16,ROUNDUP(size,1024)); @@ -1178,7 +1169,7 @@ static int call_trans2qfilepathinfo(char *inbuf, char *outbuf, int length, case SMB_QUERY_FILE_BASIC_INFO: data_size = 36; /* w95 returns 40 bytes not 36 - why ?. */ put_long_date(pdata,get_create_time(&sbuf)); - put_long_date(pdata+8,get_access_time(&sbuf)); + put_long_date(pdata+8,sbuf.st_atime); put_long_date(pdata+16,sbuf.st_mtime); /* write time */ put_long_date(pdata+24,sbuf.st_mtime); /* change time */ SIVAL(pdata,32,mode); @@ -1187,9 +1178,8 @@ static int call_trans2qfilepathinfo(char *inbuf, char *outbuf, int length, { time_t create_time = get_create_time(&sbuf); DEBUG(5,("create: %s ", ctime(&create_time))); - create_time = get_access_time(&sbuf); - DEBUG(5,("access: %s ", ctime(&create_time))); } + DEBUG(5,("access: %s ", ctime(&sbuf.st_atime))); DEBUG(5,("write: %s ", ctime(&sbuf.st_mtime))); DEBUG(5,("change: %s ", ctime(&sbuf.st_mtime))); DEBUG(5,("mode: %x\n", mode)); @@ -1243,7 +1233,7 @@ static int call_trans2qfilepathinfo(char *inbuf, char *outbuf, int length, case SMB_QUERY_FILE_ALL_INFO: put_long_date(pdata,get_create_time(&sbuf)); - put_long_date(pdata+8,get_access_time(&sbuf)); + put_long_date(pdata+8,sbuf.st_atime); put_long_date(pdata+16,sbuf.st_mtime); /* write time */ put_long_date(pdata+24,sbuf.st_mtime); /* change time */ SIVAL(pdata,32,mode); -- cgit