mirror of
https://github.com/obarthel/amiga-smbfs.git
synced 2025-12-08 14:58:35 +00:00
Updated to version 2.11
The ACTION_SETDATE operation again changes both the file/directory creation date/time and the last modification date/time. Because some SMB servers will not return a valid modification date/time, the creation date/time will be substituted when directory entry information is converted into the appropriate AmigaDOS data structures. This is problematic if only the modification time/dated is updated by the ACTION_SETDATE operation because the change may appear not to "stick". The SMB function which would be used to update both the modification and the creation time stamps did not take care to preserve the creation time stamp. This might have contributed to the ACTION_SETDATE operation not having a noticeable effect. The debug code no longer uses FORMAT_DEF for converting AmigaDOS time stamp information into readable text, but uses FORMAT_DOS instead. This is an attempt to track down a hard to detect bug in the debug code which might be related to locale.library date conversion. Because the buffer size for the date and time information is limited, the locale settings might just produce too much text to fit into the buffers. But that's only a theory so far... The functions which the debug code uses to prepare 64 bit integers and strings for display are now a bit more paranoid in watching the lengths of the resulting strings, reporting possible buffer overflows. Went over all the debug output text format strings with a fine-toothed comb and actually found a few instances of the formatting parameters not being entirely correct. The assert.c code makes a bit more of an effort to handle NULL strings for display. The non-debug builds of smbfs now complain again if any of the debug parameters are being used.
This commit is contained in:
@@ -2796,3 +2796,43 @@ smbfs 2.10 (29.12.2018)
|
||||
I am uncertain if all AmiTCP V3/V4 TCP/IP stacks implement sendmsg()
|
||||
for TCP sockets in the same consistent manner, which is why this
|
||||
feature is not enabled by default.
|
||||
|
||||
|
||||
smbfs 2.11 (31.12.2018)
|
||||
|
||||
- The ACTION_SETDATE operation again changes both the file/directory
|
||||
creation date/time and the last modification date/time. Because some
|
||||
SMB servers will not return a valid modification date/time, the
|
||||
creation date/time will be substituted when directory entry information
|
||||
is converted into the appropriate AmigaDOS data structures. This is
|
||||
problematic if only the modification time/dated is updated by the
|
||||
ACTION_SETDATE operation because the change may appear not to "stick".
|
||||
|
||||
- The SMB function which would be used to update both the modification
|
||||
and the creation time stamps did not take care to preserve the
|
||||
creation time stamp. This might have contributed to the ACTION_SETDATE
|
||||
operation not having a noticeable effect.
|
||||
|
||||
- The debug code no longer uses FORMAT_DEF for converting AmigaDOS
|
||||
time stamp information into readable text, but uses FORMAT_DOS
|
||||
instead. This is an attempt to track down a hard to detect
|
||||
bug in the debug code which might be related to locale.library
|
||||
date conversion. Because the buffer size for the date and time
|
||||
information is limited, the locale settings might just produce
|
||||
too much text to fit into the buffers. But that's only a theory
|
||||
so far...
|
||||
|
||||
- The functions which the debug code uses to prepare 64 bit integers
|
||||
and strings for display are now a bit more paranoid in watching
|
||||
the lengths of the resulting strings, reporting possible
|
||||
buffer overflows.
|
||||
|
||||
- Went over all the debug output text format strings with a
|
||||
fine-toothed comb and actually found a few instances of
|
||||
the formatting parameters not being entirely correct.
|
||||
|
||||
- The assert.c code makes a bit more of an effort to handle NULL
|
||||
strings for display.
|
||||
|
||||
- The non-debug builds of smbfs now complain again if any of the
|
||||
debug parameters are being used.
|
||||
|
||||
+12
-5
@@ -300,11 +300,18 @@ _SHOWSTRING(
|
||||
|
||||
if(debug_file == (BPTR)NULL)
|
||||
{
|
||||
kprintf("%s:%ld:%s = 0x%08lx \"%s\"\n",file,line,name,string,string);
|
||||
if(string != NULL)
|
||||
kprintf("%s:%ld:%s = 0x%08lx \"%s\"\n",file,line,name,string,string);
|
||||
else
|
||||
kprintf("%s:%ld:%s = NULL \"\"\n",file,line,name);
|
||||
}
|
||||
else
|
||||
{
|
||||
FPrintf(debug_file,"%s:%ld:%s = 0x%08lx \"%s\"\n",file,line,name,string,string);
|
||||
if(string != NULL)
|
||||
FPrintf(debug_file,"%s:%ld:%s = 0x%08lx \"%s\"\n",file,line,name,string,string);
|
||||
else
|
||||
FPrintf(debug_file,"%s:%ld:%s = NULL \"\"\n",file,line,name);
|
||||
|
||||
Flush(debug_file);
|
||||
}
|
||||
}
|
||||
@@ -558,7 +565,7 @@ _ASSERT(
|
||||
{
|
||||
if(x == 0)
|
||||
{
|
||||
kprintf("%s:%ld:Expression `%s' failed assertion in %s().\n",
|
||||
kprintf("%s:%ld:Expression '%s' failed assertion in %s().\n",
|
||||
file,
|
||||
line,
|
||||
xs,
|
||||
@@ -604,7 +611,7 @@ _ASSERT(
|
||||
|
||||
if(debug_file == (BPTR)NULL)
|
||||
{
|
||||
kprintf("%s:%ld:Expression `%s' failed assertion in %s().\n",
|
||||
kprintf("%s:%ld:Expression '%s' failed assertion in %s().\n",
|
||||
file,
|
||||
line,
|
||||
xs,
|
||||
@@ -612,7 +619,7 @@ _ASSERT(
|
||||
}
|
||||
else
|
||||
{
|
||||
FPrintf(debug_file,"%s:%ld:Expression `%s' failed assertion in %s().\n",
|
||||
FPrintf(debug_file,"%s:%ld:Expression '%s' failed assertion in %s().\n",
|
||||
file,
|
||||
line,
|
||||
xs,
|
||||
|
||||
@@ -900,7 +900,7 @@ print_smb_transaction2_subcommand(int command,enum smb_packet_source_t smb_packe
|
||||
FPrintf(dump_smb_file,"\t %s\n",convert_filetime_to_string(last_access_time));
|
||||
FPrintf(dump_smb_file,"\tlast change time = 0x%08lx%08lx\n",last_change_time[0],last_change_time[1]);
|
||||
FPrintf(dump_smb_file,"\t %s\n",convert_filetime_to_string(last_change_time));
|
||||
FPrintf(dump_smb_file,"\tend of file = %ls (0x%08lx%08lx)\n",convert_qword_to_string(end_of_file),end_of_file[0],end_of_file[1]);
|
||||
FPrintf(dump_smb_file,"\tend of file = %s (0x%08lx%08lx)\n",convert_qword_to_string(end_of_file),end_of_file[0],end_of_file[1]);
|
||||
FPrintf(dump_smb_file,"\tallocation size = %s (0x%08lx%08lx)\n",convert_qword_to_string(allocation_size),allocation_size[0],allocation_size[1]);
|
||||
|
||||
FPrintf(dump_smb_file,"\text file attributes = 0x%08lx\n",ext_file_attributes);
|
||||
|
||||
@@ -315,7 +315,7 @@ main(int argc,char *argv[])
|
||||
dat.dat_Stamp.ds_Days = ead->ed_Days;
|
||||
dat.dat_Stamp.ds_Minute = ead->ed_Mins;
|
||||
dat.dat_Stamp.ds_Tick = ead->ed_Ticks;
|
||||
dat.dat_Format = FORMAT_DEF;
|
||||
dat.dat_Format = FORMAT_DOS;
|
||||
dat.dat_StrDate = date;
|
||||
dat.dat_StrTime = time;
|
||||
|
||||
|
||||
+61
-15
@@ -31,6 +31,8 @@
|
||||
* Samba 4.6.7: smbfs debuglevel=2 debugfile=ram:ubuntu-17.log volume=ubuntu-test //ubuntu-17-olaf/test
|
||||
* Samba 4.7.6: smbfs debuglevel=2 debugfile=ram:ubuntu-18.log volume=ubuntu-test //ubuntu-18-olaf/test
|
||||
* Samba 3.0.25: smbfs debuglevel=2 debugfile=ram:samba-3.0.25.log user=olsen password=... volume=olsen //192.168.1.118/olsen
|
||||
*
|
||||
* diskspeed drive olsen:Documents dir seek fast byte nocpu
|
||||
*/
|
||||
|
||||
#include "smbfs.h"
|
||||
@@ -971,6 +973,14 @@ main(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
if(get_icon_tool_type_value("DEBUG","DEBUGLEVEL") != NULL || get_icon_tool_type_value("DEBUGFILE",NULL) != NULL)
|
||||
{
|
||||
report_error("This version of the smbfs program has no built-in debug support.");
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
/* Examine the icon's tool types and use the
|
||||
@@ -1211,6 +1221,14 @@ main(void)
|
||||
|
||||
SETDEBUGFILE(debug_file);
|
||||
}
|
||||
#else
|
||||
{
|
||||
if(args.DebugLevel != NULL || args.DebugFile != NULL)
|
||||
{
|
||||
report_error("This version of the smbfs program has no built-in debug support.");
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
D(("%s (%s)", VERS, DATE));
|
||||
@@ -4521,6 +4539,8 @@ escape_name(const TEXT * name)
|
||||
len += sizeof(truncated_suffix)-1;
|
||||
}
|
||||
|
||||
ASSERT( len < (int)sizeof(buffer) );
|
||||
|
||||
buffer[len] = '\0';
|
||||
|
||||
return(buffer);
|
||||
@@ -7058,7 +7078,7 @@ Action_ExamineObject(
|
||||
#if DEBUG
|
||||
{
|
||||
struct DateTime dat;
|
||||
TEXT date[LEN_DATSTRING],time[LEN_DATSTRING];
|
||||
TEXT date[2 * LEN_DATSTRING],time[2 * LEN_DATSTRING];
|
||||
|
||||
memset(&dat,0,sizeof(dat));
|
||||
|
||||
@@ -7066,7 +7086,7 @@ Action_ExamineObject(
|
||||
memset(time,0,sizeof(time));
|
||||
|
||||
dat.dat_Stamp = fib->fib_Date;
|
||||
dat.dat_Format = FORMAT_DEF;
|
||||
dat.dat_Format = FORMAT_DOS;
|
||||
dat.dat_StrDate = date;
|
||||
dat.dat_StrTime = time;
|
||||
|
||||
@@ -7078,6 +7098,9 @@ Action_ExamineObject(
|
||||
{
|
||||
D(("could not convert days=%ld/minutes=%ld/ticks=%ld", fib->fib_Date.ds_Days, fib->fib_Date.ds_Minute, fib->fib_Date.ds_Tick));
|
||||
}
|
||||
|
||||
ASSERT( strlen(date) < sizeof(date) );
|
||||
ASSERT( strlen(time) < sizeof(time) );
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
@@ -7260,7 +7283,7 @@ dir_scan_callback_func_exnext(
|
||||
#if DEBUG
|
||||
{
|
||||
struct DateTime dat;
|
||||
TEXT date[LEN_DATSTRING],time[LEN_DATSTRING];
|
||||
TEXT date[2 * LEN_DATSTRING],time[2 * LEN_DATSTRING];
|
||||
|
||||
memset(&dat,0,sizeof(dat));
|
||||
|
||||
@@ -7268,7 +7291,7 @@ dir_scan_callback_func_exnext(
|
||||
memset(time,0,sizeof(time));
|
||||
|
||||
dat.dat_Stamp = fib->fib_Date;
|
||||
dat.dat_Format = FORMAT_DEF;
|
||||
dat.dat_Format = FORMAT_DOS;
|
||||
dat.dat_StrDate = date;
|
||||
dat.dat_StrTime = time;
|
||||
|
||||
@@ -7280,6 +7303,9 @@ dir_scan_callback_func_exnext(
|
||||
{
|
||||
D((" could not convert days=%ld/minutes=%ld/ticks=%ld", fib->fib_Date.ds_Days, fib->fib_Date.ds_Minute, fib->fib_Date.ds_Tick));
|
||||
}
|
||||
|
||||
ASSERT( strlen(date) < sizeof(date) );
|
||||
ASSERT( strlen(time) < sizeof(time) );
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
@@ -7481,7 +7507,7 @@ dir_scan_callback_func_exall(
|
||||
st_size_quad.High = st->size_high;
|
||||
|
||||
D((" '%s'",escape_name(name)));
|
||||
D((" is directory=%s, is read-only=%ls, is hidden=%s, size=%s", st->is_dir ? "yes" : "no",st->is_read_only ? "yes" : "no",st->is_hidden ? "yes" : "no",convert_quad_to_string(&st_size_quad)));
|
||||
D((" is directory=%s, is read-only=%s, is hidden=%s, size=%s", st->is_dir ? "yes" : "no",st->is_read_only ? "yes" : "no",st->is_hidden ? "yes" : "no",convert_quad_to_string(&st_size_quad)));
|
||||
D((" next_pos=%ld eof=%ld",next_pos,eof));
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
@@ -7639,7 +7665,7 @@ dir_scan_callback_func_exall(
|
||||
/* Careful: the 'archive' attribute has exactly the opposite
|
||||
* meaning in the Amiga and the SMB worlds.
|
||||
*/
|
||||
D((" was changed since last_archive = %s",st->was_changed_since_last_archive ? "yes" : "no"));
|
||||
D((" was changed since last archive = %s",st->was_changed_since_last_archive ? "yes" : "no"));
|
||||
|
||||
if(NOT st->was_changed_since_last_archive)
|
||||
ed->ed_Prot |= FIBF_ARCHIVE;
|
||||
@@ -7665,7 +7691,7 @@ dir_scan_callback_func_exall(
|
||||
#if DEBUG
|
||||
{
|
||||
struct DateTime dat;
|
||||
TEXT date[LEN_DATSTRING],time[LEN_DATSTRING];
|
||||
TEXT date[2 * LEN_DATSTRING],time[2 * LEN_DATSTRING];
|
||||
|
||||
memset(&dat,0,sizeof(dat));
|
||||
|
||||
@@ -7675,7 +7701,7 @@ dir_scan_callback_func_exall(
|
||||
dat.dat_Stamp.ds_Days = ed->ed_Days;
|
||||
dat.dat_Stamp.ds_Minute = ed->ed_Mins;
|
||||
dat.dat_Stamp.ds_Tick = ed->ed_Ticks;
|
||||
dat.dat_Format = FORMAT_DEF;
|
||||
dat.dat_Format = FORMAT_DOS;
|
||||
dat.dat_StrDate = date;
|
||||
dat.dat_StrTime = time;
|
||||
|
||||
@@ -7687,6 +7713,9 @@ dir_scan_callback_func_exall(
|
||||
{
|
||||
D((" could not convert days=%ld/minutes=%ld/ticks=%ld", ed->ed_Days, ed->ed_Mins, ed->ed_Ticks));
|
||||
}
|
||||
|
||||
ASSERT( strlen(date) < sizeof(date) );
|
||||
ASSERT( strlen(time) < sizeof(time) );
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
@@ -8884,7 +8913,7 @@ Action_SetDate(
|
||||
#if DEBUG
|
||||
{
|
||||
struct DateTime dat;
|
||||
TEXT date[LEN_DATSTRING],time[LEN_DATSTRING];
|
||||
TEXT date[2 * LEN_DATSTRING],time[2 * LEN_DATSTRING];
|
||||
|
||||
memset(&dat,0,sizeof(dat));
|
||||
|
||||
@@ -8892,7 +8921,7 @@ Action_SetDate(
|
||||
memset(time,0,sizeof(time));
|
||||
|
||||
dat.dat_Stamp = (*ds);
|
||||
dat.dat_Format = FORMAT_DEF;
|
||||
dat.dat_Format = FORMAT_DOS;
|
||||
dat.dat_StrDate = date;
|
||||
dat.dat_StrTime = time;
|
||||
|
||||
@@ -8904,16 +8933,28 @@ Action_SetDate(
|
||||
{
|
||||
D(("could not convert days=%ld/minutes=%ld/ticks=%ld", ds->ds_Days, ds->ds_Minute, ds->ds_Tick));
|
||||
}
|
||||
|
||||
ASSERT( strlen(date) < sizeof(date) );
|
||||
ASSERT( strlen(time) < sizeof(time) );
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
seconds = (ds->ds_Days * 24 * 60 + ds->ds_Minute) * 60 + (ds->ds_Tick / TICKS_PER_SECOND);
|
||||
|
||||
st.ctime = 0;
|
||||
/* We change both the creation date/time and the last modification
|
||||
* date/time because the SMB server may not initialize all four
|
||||
* date/time records for ACTION_EXAMINE/ACTION_EXNEXT/ACTION_EXAMINE_ALL
|
||||
* to use. The modification date/time may be missing, so the
|
||||
* creation date/time is used in its stead.
|
||||
*
|
||||
* Unless we initialize it here, the ACTION_EXAMINE/ACTION_EXNEXT/ACTION_EXAMINE_ALL
|
||||
* 'Date file last changed' may always end up using the creation time.
|
||||
*/
|
||||
st.ctime = seconds + UNIX_TIME_OFFSET + get_time_zone_delta();
|
||||
st.mtime = st.ctime;
|
||||
st.atime = 0;
|
||||
st.mtime = seconds + UNIX_TIME_OFFSET + get_time_zone_delta();
|
||||
|
||||
D(("mtime = %lu",st.mtime));
|
||||
D(("ctime = mtime = %lu",st.ctime));
|
||||
|
||||
if(smba_setattr(file,&st,NULL,&error) < 0)
|
||||
{
|
||||
@@ -9067,7 +9108,7 @@ Action_ExamineFH(
|
||||
#if DEBUG
|
||||
{
|
||||
struct DateTime dat;
|
||||
TEXT date[LEN_DATSTRING],time[LEN_DATSTRING];
|
||||
TEXT date[2 * LEN_DATSTRING],time[2 * LEN_DATSTRING];
|
||||
|
||||
memset(&dat,0,sizeof(dat));
|
||||
|
||||
@@ -9075,7 +9116,7 @@ Action_ExamineFH(
|
||||
memset(time,0,sizeof(time));
|
||||
|
||||
dat.dat_Stamp = fib->fib_Date;
|
||||
dat.dat_Format = FORMAT_DEF;
|
||||
dat.dat_Format = FORMAT_DOS;
|
||||
dat.dat_StrDate = date;
|
||||
dat.dat_StrTime = time;
|
||||
|
||||
@@ -9087,6 +9128,9 @@ Action_ExamineFH(
|
||||
{
|
||||
D(("could not convert days=%ld/minutes=%ld/ticks=%ld", fib->fib_Date.ds_Days, fib->fib_Date.ds_Minute, fib->fib_Date.ds_Tick));
|
||||
}
|
||||
|
||||
ASSERT( strlen(date) < sizeof(date) );
|
||||
ASSERT( strlen(time) < sizeof(time) );
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
@@ -10831,6 +10875,8 @@ convert_quad_to_string(const QUAD * const number)
|
||||
break;
|
||||
}
|
||||
|
||||
ASSERT( len+1 >= 0 );
|
||||
|
||||
return(&string[len+1]);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -1656,7 +1656,7 @@ smb_proc_read_raw (
|
||||
struct smb_dirent *finfo,
|
||||
const QUAD * const offset_quad,
|
||||
long count,
|
||||
char *data,
|
||||
char * data,
|
||||
int * error_ptr)
|
||||
{
|
||||
char *buf = server->transmit_buffer;
|
||||
@@ -4381,7 +4381,7 @@ smb_proc_reconnect (struct smb_server *server, int * error_ptr)
|
||||
dword server_sesskey;
|
||||
|
||||
/*
|
||||
LOG (("password = %s\n",server->mount_data.password*));
|
||||
LOG (("password = %s\n",server->mount_data.password));
|
||||
*/
|
||||
LOG (("usernam = %s\n",server->mount_data.username));
|
||||
LOG (("blkmode = %ld\n",WVAL (packet, smb_vwv5)));
|
||||
@@ -4984,7 +4984,7 @@ smb_printerr (int class, int num)
|
||||
|
||||
report_error ("%s - %s (%s).", err_classes[i].class, err[j].name, err[j].message);
|
||||
|
||||
LOG (("%s - %s (%s)\n",err_classes[i].class, err[j].name,err[j].message));
|
||||
LOG (("%s - %s (%s)\n", err_classes[i].class, err[j].name, err[j].message));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,9 +421,17 @@ make_open (smba_file_t * f, int need_fid, int writable, int truncate_file, int *
|
||||
if (!f->is_valid || f->attr_time == 0 || (now > f->attr_time && now - f->attr_time > ATTR_CACHE_TIME))
|
||||
{
|
||||
if (!f->server->server.prefer_core_protocol && f->server->server.protocol >= PROTOCOL_LANMAN2)
|
||||
{
|
||||
SHOWMSG("using the LAN Manager 2.0 getattr() variant");
|
||||
|
||||
result = smb_query_path_information (&s->server, f->dirent.complete_path, f->dirent.len, 0, &f->dirent, error_ptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
SHOWMSG("using the legacy getattr() variant");
|
||||
|
||||
result = smb_proc_getattr_core (&s->server, f->dirent.complete_path, f->dirent.len, &f->dirent, error_ptr);
|
||||
}
|
||||
|
||||
if (result < 0)
|
||||
goto out;
|
||||
@@ -439,6 +447,8 @@ make_open (smba_file_t * f, int need_fid, int writable, int truncate_file, int *
|
||||
{
|
||||
LOG (("opening file '%s'\n", escape_name(f->dirent.complete_path)));
|
||||
|
||||
SHOWMSG("using the LAN Manager 2.0 open() variant");
|
||||
|
||||
result = smb_proc_open (&s->server, f->dirent.complete_path, f->dirent.len, writable, truncate_file, &f->dirent, error_ptr);
|
||||
if (result < 0)
|
||||
goto out;
|
||||
@@ -455,6 +465,8 @@ make_open (smba_file_t * f, int need_fid, int writable, int truncate_file, int *
|
||||
{
|
||||
LOG (("opening file '%s'\n", escape_name(f->dirent.complete_path)));
|
||||
|
||||
SHOWMSG("using the legacy open() variant");
|
||||
|
||||
result = smb_proc_open (&s->server, f->dirent.complete_path, f->dirent.len, writable, truncate_file, &f->dirent, error_ptr);
|
||||
if (result < 0)
|
||||
goto out;
|
||||
@@ -610,17 +622,23 @@ write_attr (smba_file_t * f, int * error_ptr)
|
||||
{
|
||||
/* Copy these, because make_open() may overwrite them. */
|
||||
time_t mtime = f->dirent.mtime;
|
||||
time_t ctime = f->dirent.ctime;
|
||||
dword attr = f->dirent.attr;
|
||||
|
||||
LOG(("mtime = %lu\n",f->dirent.mtime));
|
||||
LOG(("ctime = %lu\n",f->dirent.ctime));
|
||||
|
||||
SHOWMSG("using the LAN Manager 2.0 open() variant");
|
||||
|
||||
result = make_open (f, open_need_fid, open_writable, open_dont_truncate, error_ptr);
|
||||
if (result < 0)
|
||||
goto out;
|
||||
|
||||
LOG(("mtime = %lu\n",f->dirent.mtime));
|
||||
LOG(("ctime = %lu\n",f->dirent.ctime));
|
||||
|
||||
f->dirent.mtime = mtime;
|
||||
f->dirent.ctime = ctime;
|
||||
f->dirent.attr = attr;
|
||||
|
||||
result = smb_set_file_information (&f->server->server, &f->dirent, NULL, error_ptr);
|
||||
@@ -633,17 +651,23 @@ write_attr (smba_file_t * f, int * error_ptr)
|
||||
{
|
||||
/* Copy these, because make_open() may overwrite them. */
|
||||
time_t mtime = f->dirent.mtime;
|
||||
time_t ctime = f->dirent.ctime;
|
||||
dword attr = f->dirent.attr;
|
||||
|
||||
LOG(("mtime = %lu\n",f->dirent.mtime));
|
||||
LOG(("ctime = %lu\n",f->dirent.ctime));
|
||||
|
||||
SHOWMSG("using the legacy open() variant");
|
||||
|
||||
result = make_open (f, open_dont_need_fid, open_writable, open_dont_truncate, error_ptr);
|
||||
if (result < 0)
|
||||
goto out;
|
||||
|
||||
LOG(("mtime = %lu\n",f->dirent.mtime));
|
||||
LOG(("ctime = %lu\n",f->dirent.ctime));
|
||||
|
||||
f->dirent.mtime = mtime;
|
||||
f->dirent.ctime = ctime;
|
||||
f->dirent.attr = attr;
|
||||
|
||||
/* If the attributes need to be updated, we cannot use smb_proc_setattrE(),
|
||||
@@ -1241,7 +1265,7 @@ smba_getattr (smba_file_t * f, smba_stat_t * data, int * error_ptr)
|
||||
|
||||
if (!f->server->server.prefer_core_protocol && f->server->server.protocol >= PROTOCOL_LANMAN2)
|
||||
{
|
||||
LOG(("using smb_query_path_information\n"));
|
||||
SHOWMSG("using the LAN Manager 2.0 path query variant");
|
||||
|
||||
if (f->dirent.opened)
|
||||
result = smb_query_path_information (&f->server->server, NULL, 0, f->dirent.fileid, &f->dirent, error_ptr);
|
||||
@@ -1250,6 +1274,8 @@ smba_getattr (smba_file_t * f, smba_stat_t * data, int * error_ptr)
|
||||
}
|
||||
else
|
||||
{
|
||||
SHOWMSG("using the legacy path query variant");
|
||||
|
||||
if (f->dirent.opened && f->server->supports_E)
|
||||
{
|
||||
LOG(("using smb_proc_getattrE\n"));
|
||||
@@ -1358,9 +1384,17 @@ smba_setattr (smba_file_t * f, const smba_stat_t * st, const QUAD * const size,
|
||||
goto out;
|
||||
|
||||
if(!f->server->server.prefer_core_protocol && f->server->server.protocol >= PROTOCOL_LANMAN2)
|
||||
{
|
||||
SHOWMSG("using the LAN Manager 2.0 trunc variant");
|
||||
|
||||
result = smb_set_file_information (&f->server->server, &f->dirent, size, error_ptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
SHOWMSG("using the legacy trunc variant (which cannot truncate files)");
|
||||
|
||||
result = smb_proc_trunc (&f->server->server, &f->dirent, size->Low, error_ptr);
|
||||
}
|
||||
|
||||
if(result < 0)
|
||||
goto out;
|
||||
@@ -1571,12 +1605,16 @@ smba_create (smba_file_t * dir, const char *name, int truncate, int * error_ptr)
|
||||
|
||||
if (!dir->server->server.prefer_core_protocol && dir->server->server.protocol >= PROTOCOL_LANMAN2)
|
||||
{
|
||||
SHOWMSG("using the LAN Manager 2.0 creat variant");
|
||||
|
||||
result = smb_proc_open (&dir->server->server, path, path_len, open_writable, truncate, &entry, error_ptr);
|
||||
if(result < 0)
|
||||
goto out;
|
||||
}
|
||||
else
|
||||
{
|
||||
SHOWMSG("using the legacy creat variant");
|
||||
|
||||
result = smb_proc_create (&dir->server->server, path, path_len, &entry, error_ptr);
|
||||
if(result < 0)
|
||||
goto out;
|
||||
@@ -2276,7 +2314,8 @@ smba_start(
|
||||
par.username = username;
|
||||
par.password = password;
|
||||
|
||||
LOG(("server name = '%s', client name = '%s', workgroup name = '%s', user name = '%s'\n", server_name, client_name, workgroup, username));
|
||||
LOG(("server name = '%s', client name = '%s', workgroup name = '%s', user name = '%s'\n",
|
||||
server_name, client_name, workgroup, username));
|
||||
|
||||
if(smba_connect (
|
||||
&par,
|
||||
@@ -2311,11 +2350,13 @@ smba_start(
|
||||
|
||||
smb_translate_error_class_and_code((*smb_error_class_ptr),(*smb_error_ptr),&smb_class_name,&smb_code_text);
|
||||
|
||||
report_error("Could not connect to server '%s' (%ld/%ld, %s/%s).",server,(*smb_error_class_ptr),(*smb_error_ptr),smb_class_name,smb_code_text);
|
||||
report_error("Could not connect to server '%s' (%ld/%ld, %s/%s).",
|
||||
server,(*smb_error_class_ptr),(*smb_error_ptr),smb_class_name,smb_code_text);
|
||||
}
|
||||
else
|
||||
{
|
||||
report_error("Could not connect to server '%s' (%ld, %s).",server,(*error_ptr),posix_strerror(*error_ptr));
|
||||
report_error("Could not connect to server '%s' (%ld, %s).",
|
||||
server,(*error_ptr),posix_strerror(*error_ptr));
|
||||
}
|
||||
|
||||
goto out;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#define VERSION 2
|
||||
#define REVISION 10
|
||||
#define DATE "29.12.2018"
|
||||
#define VERS "smbfs 2.10"
|
||||
#define VSTRING "smbfs 2.10 (29.12.2018)\r\n"
|
||||
#define VERSTAG "\0$VER: smbfs 2.10 (29.12.2018)"
|
||||
#define REVISION 11
|
||||
#define DATE "31.12.2018"
|
||||
#define VERS "smbfs 2.11"
|
||||
#define VSTRING "smbfs 2.11 (31.12.2018)\r\n"
|
||||
#define VERSTAG "\0$VER: smbfs 2.11 (31.12.2018)"
|
||||
|
||||
@@ -1 +1 @@
|
||||
10
|
||||
11
|
||||
|
||||
+32
-6
@@ -106,6 +106,9 @@ smb_discard_netbios_frames(struct smb_server *server, int sock_fd, int * error_p
|
||||
|
||||
ENTER();
|
||||
|
||||
ASSERT( server != NULL );
|
||||
ASSERT( error_ptr != NULL );
|
||||
|
||||
/* Read the NetBIOS session header (rfc-1002, section 4.3.1) */
|
||||
result = receive_all (sock_fd, netbios_session_buf, NETBIOS_HEADER_SIZE, error_ptr);
|
||||
if (result < 0)
|
||||
@@ -203,9 +206,10 @@ smb_receive_raw (
|
||||
int * error_ptr)
|
||||
{
|
||||
unsigned char netbios_session_buf[NETBIOS_HEADER_SIZE];
|
||||
int netbios_session_payload_size;
|
||||
int netbios_session_payload_size = 0;
|
||||
int len, result;
|
||||
|
||||
ASSERT( server != NULL );
|
||||
ASSERT( error_ptr != NULL );
|
||||
|
||||
/* We need to read the NetBIOS session header before we can move
|
||||
@@ -229,7 +233,7 @@ smb_receive_raw (
|
||||
|
||||
if (result < NETBIOS_HEADER_SIZE)
|
||||
{
|
||||
LOG (("expected %ld bytes, got %ld\n", NETBIOS_HEADER_SIZE, result));
|
||||
LOG (("expected %ld bytes, got %ld for the NetBIOS header\n", NETBIOS_HEADER_SIZE, result));
|
||||
|
||||
(*error_ptr) = error_end_of_file;
|
||||
|
||||
@@ -253,8 +257,8 @@ smb_receive_raw (
|
||||
* anyway so it doesn't matter if we ignore any
|
||||
* data beyond the first 256 bytes.
|
||||
*/
|
||||
if(netbios_session_payload_size > 256)
|
||||
netbios_session_payload_size = 256;
|
||||
if(netbios_session_payload_size > (int)sizeof(netbios_session_payload))
|
||||
netbios_session_payload_size = sizeof(netbios_session_payload);
|
||||
|
||||
result = receive_all (sock_fd, netbios_session_payload, netbios_session_payload_size, error_ptr);
|
||||
if (result < 0)
|
||||
@@ -351,6 +355,8 @@ smb_receive_raw (
|
||||
/* Prepend the NetBIOS header to what is read? */
|
||||
if (want_header)
|
||||
{
|
||||
ASSERT( target != NULL );
|
||||
|
||||
memcpy (target, netbios_session_buf, NETBIOS_HEADER_SIZE);
|
||||
target += NETBIOS_HEADER_SIZE;
|
||||
}
|
||||
@@ -404,6 +410,8 @@ smb_receive_raw (
|
||||
|
||||
LOG(("SMBreadX: reading the first %ld bytes\n", 59));
|
||||
|
||||
ASSERT( target != NULL );
|
||||
|
||||
result = receive_all (sock_fd, target, 59, error_ptr);
|
||||
if (result < 0)
|
||||
{
|
||||
@@ -533,6 +541,8 @@ smb_receive_raw (
|
||||
|
||||
LOG(("SMBread: reading the first %ld bytes\n", 48));
|
||||
|
||||
ASSERT( target != NULL );
|
||||
|
||||
result = receive_all (sock_fd, target, 48, error_ptr);
|
||||
if (result < 0)
|
||||
{
|
||||
@@ -677,6 +687,8 @@ smb_receive_raw (
|
||||
{
|
||||
LOG(("receiving SMB message and payload in one chunk\n"));
|
||||
|
||||
ASSERT( target != NULL );
|
||||
|
||||
result = receive_all (sock_fd, target, len, error_ptr);
|
||||
if (result < 0)
|
||||
{
|
||||
@@ -777,6 +789,8 @@ smb_receive_raw (
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSERT( target != NULL );
|
||||
|
||||
result = receive_all (sock_fd, target, len, error_ptr);
|
||||
if (result < 0)
|
||||
{
|
||||
@@ -1108,7 +1122,10 @@ smb_connect (struct smb_server *server, int * error_ptr)
|
||||
server->mount_data.fd = result;
|
||||
}
|
||||
|
||||
LOG(("connecting to server %s:%ld with socket %ld\n", Inet_NtoA(server->mount_data.addr.sin_addr.s_addr), ntohs(server->mount_data.addr.sin_port), server->mount_data.fd));
|
||||
LOG(("connecting to server %s:%ld with socket %ld\n",
|
||||
Inet_NtoA(server->mount_data.addr.sin_addr.s_addr),
|
||||
ntohs(server->mount_data.addr.sin_port),
|
||||
server->mount_data.fd));
|
||||
|
||||
/* Wait a certain time period for the connection attempt to succeed? */
|
||||
if(server->timeout > 0)
|
||||
@@ -1406,7 +1423,12 @@ smb_request (
|
||||
}
|
||||
}
|
||||
|
||||
LOG (("len = %ld, cmd = 0x%lx, input_payload=0x%08lx, output_payload=0x%08lx, payload_size=%ld\n", len, buffer[8], input_payload, output_payload, payload_size));
|
||||
LOG (("len = %ld, cmd = 0x%lx, input_payload=0x%08lx, output_payload=0x%08lx, payload_size=%ld\n",
|
||||
len,
|
||||
buffer[8],
|
||||
input_payload,
|
||||
output_payload,
|
||||
payload_size));
|
||||
|
||||
#if defined(DUMP_SMB)
|
||||
dump_netbios_header(__FILE__,__LINE__,buffer,&buffer[NETBIOS_HEADER_SIZE],len);
|
||||
@@ -1559,6 +1581,10 @@ smb_trans2_request (
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Perform the actual read operation for the SMBreadbraw command, for which
|
||||
* the transmit buffer has already been set up, ready to be used. This
|
||||
* function is called by smb_proc_read_raw().
|
||||
*/
|
||||
int
|
||||
smb_request_read_raw (struct smb_server *server, unsigned char *target, int max_len, int * error_ptr)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user