Commit Graph
95 Commits
Author SHA1 Message Date
Olaf Barthel 8a5125fc99 Updated to build properly for AmigaOS4 2016-04-09 11:28:39 +02:00
Olaf Barthel 8402a08510 Added the remaining error codes 2016-04-09 11:27:17 +02:00
Olaf Barthel e952448551 Added note on where smb_receive_trans2() SMB errors are checked
smb_receive_trans2() exits with return code of -EIO if the SMB error code is set.
2016-04-09 11:25:56 +02:00
Olaf Barthel f2bbe982fe Failed writes need to update file size / Dir cache cleanup simplification
Because the series of write operations are not wrapped into transactions, the cached file size needs to be updated if at least one write access succeeds.

Simplified the directory cache cleanup.
2016-04-09 11:22:32 +02:00
Olaf Barthel 3ff8a79053 Message length fix / Error message update
The SMB message length bit #17 is now properly filled in with the respective bit of the payload length.

Added the remaining error codes covered by the "Common Internet File System (CIFS) Protocol" documentation.
2016-04-09 11:20:19 +02:00
Olaf Barthel 0cce69b02b Only build this when needed 2016-04-09 11:01:33 +02:00
Olaf Barthel 8b0b3fbe48 Version bump 2016-04-04 14:22:20 +02:00
Olaf Barthel eeef16d367 Version bump 2016-04-03 11:40:39 +02:00
Olaf Barthel 5a0c3d1a85 SMB message header initialized revised
The SMB message header is now zeroed in exactly one place only.

The SMB_COM_TREE_CONNECT_ANDX client request no longer sets the message error field.
2016-04-03 11:40:23 +02:00
Olaf Barthel 68561da83d Workaround for minimum stack size requirements
smbfs will not work properly with the standard 4K stack size. Testing revealed that 20K are safer, which is why the program startup code now provides as much if needed.
2016-04-03 11:38:06 +02:00
Olaf Barthel 6456d8e537 Version bump 2016-04-02 12:34:47 +02:00
Olaf Barthel 294e81c0ce Added support for UTF-8 encoded file and directory names 2016-04-02 12:33:51 +02:00
Olaf Barthel 4141b8bd63 Copyright update 2016-04-02 12:33:08 +02:00
Olaf Barthel 3c836b5998 NT status codes are now decoded properly 2016-04-02 12:33:01 +02:00
Olaf Barthel a920b1818d blkmode becomes capabilities
The client capabilities were never properly initialized, which could have led to any number of interesting side-effects, such as NT status information being transmitted instead.

The client now announces itself as a Unix system if the server does so, too.

The record locking command did not initialize the oplock level at all. Fixed.

Other SMB packets were not completely initialized either, which has been corrected.
2016-04-02 12:32:28 +02:00
Olaf Barthel d12b42b72c blkmod becomes capabilities 2016-04-02 12:29:40 +02:00
Olaf Barthel 4a769ec098 Indentation cleanup / blkmode becomes capabilities 2016-04-02 12:29:15 +02:00
Olaf Barthel 93dc9c4c19 Indentation cleanup 2016-04-02 12:28:57 +02:00
Olaf Barthel 79ea7303a9 Copyright update 2016-04-02 12:28:02 +02:00
Olaf Barthel d6fe46462f Added UTF-8 conversion functions 2016-04-02 12:27:49 +02:00
Olaf Barthel abba9e78ce Copyright update 2016-04-02 12:27:30 +02:00
Olaf Barthel 37bb0e3acf Copyright update 2016-04-02 12:27:19 +02:00
Olaf Barthel 4f5df763b1 Copyright update 2016-04-02 12:26:58 +02:00
Olaf Barthel 1f4ee3b104 Version bump 2016-04-01 16:39:14 +02:00
Olaf Barthel 6d88625bff Minor indentation fixes 2016-04-01 16:39:04 +02:00
Olaf Barthel 7671abcb86 NetBIOS session and SMB packets are decoded separately
SMB packet decoder now ignores empty parameter/data and will not try to decode and display these.

SMB_COM_SEARCH decoding had the sources mixed up, decoding client->server traffic as server->client traffic and the other way round.

Decoding of the status field now works properly again in the non-"status32" case.
2016-04-01 16:38:44 +02:00
Olaf Barthel 7a4cf2e4ec Fixes for smba_read() and smba_write()
smba_read() failed to register the number of bytes read successfully by smb_proc_read_raw(). This made all files appear to be empty.

smba_write() did not update the offset value correctly if the first smb_proc_write() call had succeeded.
2016-04-01 16:35:33 +02:00
Olaf Barthel 85e33f1088 NetBIOS session header is decoded separately
Decoding is performed before the session header type is checked and, if necessary, rejected.

smb_receive_raw() now only accepts a single session header type (message) and rejects all others. At this stage "positive session response" should no longer appear.
2016-04-01 16:33:37 +02:00
Olaf Barthel d85b7afd8d Version bump 2016-03-30 13:49:02 +02:00
Olaf Barthel 8bb63e19b5 Small indentation fixes 2016-03-30 13:48:48 +02:00
Olaf Barthel 2adfed7183 success/error handling is now consistent
All functions now follow a consistent error reporting scheme. A negative return value always indicates an error condition. A return value of 0 always indicates success, except for the few functions which have to return a count of bytes or directory records upon success.

Previously, it was hard to tell what function returned what in case of error, which led the bugs in smba_write() and smba_read(), neither of which gracefully fell back on SMB_COM_WRITE/SMB_COM_READ, respectively if SMB_COM_WRITE_RAW/SMB_COM_READ_RAW failed.

State variables are now named according to their respective purpose where possible. Previously, it was "rval", "errnum", "result" which were used almost interchangeably regardless of purpose.
2016-03-30 13:48:32 +02:00
Olaf Barthel d8e77ce386 Rolled back a "bug fix" / SMB_COM_WRITE_RAW handling corrected
Turns out that the length filled in by smb_setup_header() was not actually off by 4 bytes but entirely correct. This caused SMB packets to be sent four bytes short, and probably causing some SMB server implementations to ignore them altogether.

A successful SMB_COM_WRITE_RAW command may cause the server to send interim progress update responses, ending with a final SMB_COM_WRITE_RAW_COMPLETE message. This is now handled correctly.
2016-03-30 13:43:56 +02:00
Olaf Barthel 248d0cf759 Documentation comments added 2016-03-30 13:40:34 +02:00
Olaf Barthel 12adae4398 Small fixes for embarrassing bugs
The 'struct tm tm' declaration in convert_smb_date_time_to_tm() must be static, not auto.

Seek mode decoding was off by one.
2016-03-30 13:40:07 +02:00
Olaf Barthel 2c90cdbeb1 Version bump 2016-03-29 13:58:57 +02:00
Olaf Barthel 450006bb4d Added more debugging information
Signed quantities are now used as such, e.g. the server time zone.

The SMB_COM_READ/WRITE/READ_RAW/WRITE_RAW data is now printed in the scope it was intended for, e.g. the SMB_COM_WRITE_RAW data output begins at the indicated offset rather than at the padding bytes which may precede it.

Added server/client capability flags covered by "Implementing CIFS", but not by the Microsoft reference documentation.

The NetBIOS session header contents are now printed along with the SMB header information.

Added GPLv2 header text.
2016-03-29 13:58:42 +02:00
Olaf Barthel e14e2d0133 Debug output now includes NetBIOS session header 2016-03-29 13:54:05 +02:00
Olaf Barthel 881070ec30 Version bump 2016-03-28 12:12:20 +02:00
Olaf Barthel 7a85bd1a23 Date/time/size conversion fixes
The SMB date/time, filetime and utime information is now converted into display format instead of just showing up as hexadecimal format numbers.

The end-of-file and allocation size values are now printed in decimal format in addition to hexadecimal format.
2016-03-28 12:12:09 +02:00
Olaf Barthel 2fc3650b2e Leftover indendation fixes 2016-03-28 12:09:54 +02:00
Olaf Barthel 27acd498d2 Minor loop refactoring 2016-03-28 12:09:28 +02:00
Olaf Barthel 00b5bf7fcf Added dependency for quad_math.h 2016-03-28 12:09:12 +02:00
Olaf Barthel 5fd0a33b76 Header comment cleaned up 2016-03-28 12:08:55 +02:00
Olaf Barthel a386f6ce02 Version bump 2016-03-27 18:14:43 +02:00
Olaf Barthel 3562ef9720 Bug fix for random junk in first file data
smba_read() could end up returning random junk in the first few bytes of a file because the make_open() return value tripped it up.
2016-03-27 18:14:30 +02:00
Olaf Barthel 6b3e54c1db Added documentation comments
Made a note of the fact that the SMB_COM_READ_RAW may be followed by more than one response by the server. The current implementation only catches one response.

The data transmitted by the SMB_COM_WRITE_RAW command is no longer decoded as if it were an SMB message.
2016-03-27 18:13:11 +02:00
Olaf Barthel ba332083a4 Cleaned up the indentation 2016-03-27 18:11:12 +02:00
Olaf Barthel 6c1451f146 Moved the test examples behind the header comment 2016-03-27 18:10:38 +02:00
Olaf Barthel ef4f02546e Error codes and decoded message output reworked
Time is now printed uniformly in hexadecimal format.
dword data is now printed as unsigned integer values.
Decoded error messages should be a bit more readable.
2016-03-27 18:09:59 +02:00
Olaf Barthel d59fc688bb Refactored SMB message decoder
The decoder now handles all SMB commands which the smbfs file system uses, including the two subcommands of the SMB_COM_TRANSACTION2 command which are used (TRANS2_FIND_FIRST2 and TRANS2_FIND_NEXT2).

This is still very ugly and very complex code, but hopefully the next version will only be ugly...
2016-03-27 12:33:03 +02:00