Updated to version 1.132

Please keep in mind that this is still a development version and might surprise you (not necessarily in a good way).

Do not let me discourage you to build and test this version, although there will be some risks involved such as data corruption or loss of data.
This commit is contained in:
obarthel
2018-05-19 15:43:09 +02:00
parent 6b58679cd6
commit afe7b87f24
18 changed files with 2096 additions and 875 deletions
Executable → Regular
+6 -5
View File
@@ -52,10 +52,10 @@ enum smb_conn_state
struct smb_dskattr
{
word total;
word allocblocks;
word blocksize;
word free;
dword total;
dword allocblocks;
dword blocksize;
dword free;
};
/*
@@ -65,7 +65,7 @@ struct smb_dirent
{
int opened; /* is it open on the fileserver? */
word fileid; /* What id to handle a file with? */
word attr; /* Attribute fields, DOS value */
dword attr; /* Attribute fields, DOS value */
time_t atime, mtime,
wtime, ctime; /* Times, as seen by the server, normalized */
@@ -73,6 +73,7 @@ struct smb_dirent
/* proc.c */
unsigned long size; /* File size. */
char * complete_path; /* Complete path, MS-DOS notation, with '\' */
size_t complete_path_size; /* Number of bytes allocated for name */
int len; /* Namelength. */
+7 -4
View File
@@ -47,13 +47,14 @@ int smb_len(const byte *packet);
void smb_translate_error_class_and_code(int errcls,int error,char ** class_ptr,char ** code_ptr);
int smb_errno(int errcls, int error);
int smb_payload_size(const struct smb_server *server, int wct, int bcc);
int smb_proc_open(struct smb_server *server, const char *pathname, int len, struct smb_dirent *entry, int * error_ptr);
int smb_proc_open(struct smb_server *server, const char *pathname, int len, int writable, int truncate, struct smb_dirent *entry, int * error_ptr);
int smb_proc_close(struct smb_server *server, word fileid, dword mtime, int * error_ptr);
int smb_proc_read(struct smb_server *server, struct smb_dirent *finfo, off_t offset, long count, char *data, int * error_ptr);
int smb_proc_read_raw(struct smb_server *server, struct smb_dirent *finfo, off_t offset, long count, char *data, int * error_ptr);
int smb_proc_write (struct smb_server *server, struct smb_dirent *finfo, off_t offset, long count, const char *data, int * error_ptr);
int smb_proc_write_raw(struct smb_server *server, struct smb_dirent *finfo, off_t offset, long count, const char *data, int * error_ptr);
int smb_proc_lseek (struct smb_server *server, struct smb_dirent *finfo, off_t offset, int mode, off_t * new_position_ptr, int * error_ptr);
int smb_proc_writex (struct smb_server *server, struct smb_dirent *finfo, off_t offset, long count, const char *data, int * error_ptr);
int smb_proc_readx (struct smb_server *server, struct smb_dirent *finfo, off_t offset, long count, char *data, int * error_ptr);
int smb_proc_lockingX (struct smb_server *server, struct smb_dirent *finfo, struct smb_lkrng *locks, int num_entries, int mode, long timeout, int * error_ptr);
int smb_proc_create(struct smb_server *server, const char *path, int len, struct smb_dirent *entry, int * error_ptr);
int smb_proc_mv(struct smb_server *server, const char *opath, const int olen, const char *npath, const int nlen, int * error_ptr);
@@ -64,6 +65,8 @@ int smb_proc_trunc(struct smb_server *server, word fid, dword length, int * erro
int smb_proc_readdir(struct smb_server *server, char *path, int fpos, int cache_size, struct smb_dirent *entry, int * error_ptr);
int smb_proc_getattr_core(struct smb_server *server, const char *path, int len, struct smb_dirent *entry, int * error_ptr);
int smb_proc_getattrE(struct smb_server *server, struct smb_dirent *entry, int * error_ptr);
int smb_query_path_information(struct smb_server *server, const char *path, int len, int fid, struct smb_dirent *entry, int * error_ptr);
int smb_set_file_information(struct smb_server *server, struct smb_dirent *entry, const dword * size_ptr, int * error_ptr);
int smb_proc_setattr_core(struct smb_server *server, const char *path, int len, struct smb_dirent *new_finfo, int * error_ptr);
int smb_proc_setattrE(struct smb_server *server, word fid, struct smb_dirent *new_entry, int * error_ptr);
int smb_proc_dskattr (struct smb_server *server, struct smb_dskattr *attr, int * error_ptr);
@@ -73,8 +76,8 @@ int smb_proc_connect(struct smb_server *server, int * error_ptr);
void smb_check_server_connection(struct smb_server *server, int error);
void smb_release(struct smb_server *server);
int smb_connect(struct smb_server *server, int * error_ptr);
int smb_request(struct smb_server *server,void * input_payload,const void * output_payload,int payload_size, int * error_ptr);
int smb_trans2_request(struct smb_server *server, int *data_len, int *param_len, char **data, char **param, int * error_ptr);
int smb_request(struct smb_server *server, int command, void * input_payload,const void * output_payload,int payload_size, int * error_ptr);
int smb_trans2_request(struct smb_server *server, int command, int *data_len, int *param_len, char **data, char **param, int * error_ptr);
int smb_request_read_raw(struct smb_server *server, unsigned char *target, int max_len, int * error_ptr);
int smb_request_write_raw(struct smb_server *server, unsigned const char *source, int length, int * error_ptr);
+12
View File
@@ -65,6 +65,12 @@ struct smb_server
/* olsen (2018-05-09): Timeout for send/receive operations in seconds. */
int timeout;
/* olsen (2018-05-14): Don't retry establishing a server connection. */
int dont_retry;
/* olsen (2018-05-18): Override the "Native OS" name passed to the server. */
char * native_os;
};
#define NEGOTIATE_USER_SECURITY 0x01 /* If set, the server supports
@@ -83,4 +89,10 @@ struct smb_server
#define CAP_RAW_MODE 0x00000001 /* The server supports SMB_COM_WRITE_RAW
and SMB_COM_READ_RAW requests. */
#define CAP_LARGE_READX 0x00004000 /* The server permits SMB_COM_READ_ANDX
to read up to 65535 bytes. */
#define CAP_LARGE_WRITEX 0x00008000 /* The server permits SMB_COM_WRITE_ANDX
to write up to 65535 bytes. */
#endif
Executable → Regular
+45 -6
View File
@@ -51,6 +51,7 @@
#define ERRnoresource 89
#define ERRtoomanyuids 90
#define ERRbaduid 91
#define ERRinvalidname 123 /* Object name collision */
#define ERRbadpipe 230 /* Named pipe invalid */
#define ERRpipebusy 231 /* All instances of pipe are busy */
#define ERRpipeclosing 232 /* named pipe close in progress */
@@ -265,28 +266,66 @@
#define SMBfclose 0x84 /* find close */
#define SMBinvalid 0xFE /* invalid command */
/* Extended 2.0 protocol */
/* Extended 2.0 protocol (LAN Manager 2.0) */
#define SMBtrans2 0x32 /* TRANS2 protocol set */
#define SMBtranss2 0x33 /* TRANS2 protocol set, secondary command */
#define SMBfindclose 0x34 /* Terminate a TRANSACT2_FINDFIRST */
#define SMBfindnclose 0x35 /* Terminate a TRANSACT2_FINDNOTIFYFIRST */
#define SMBulogoffX 0x74 /* user logoff */
/* NT LAN Manager */
#define SMBntcreateX 0xA2 /* Create or open file */
/* these are the TRANS2 sub commands */
#define TRANSACT2_OPEN 0
#define TRANSACT2_FINDFIRST 1
#define TRANSACT2_FINDNEXT 2
#define TRANSACT2_QFSINFO 3
#define TRANSACT2_QFSINFO 3 /* TRANS2_QUERY_FS_INFORMATION */
#define TRANSACT2_SETFSINFO 4
#define TRANSACT2_QPATHINFO 5
#define TRANSACT2_SETPATHINFO 6
#define TRANSACT2_QPATHINFO 5 /* TRANS2_QUERY_PATH_INFORMATION */
#define TRANSACT2_SETPATHINFO 6 /* TRANS2_SET_PATH_INFORMATION */
#define TRANSACT2_QFILEINFO 7
#define TRANSACT2_SETFILEINFO 8
#define TRANSACT2_FSCTL 9
#define TRANSACT2_IOCTL 10
#define TRANSACT2_FINDNOTIFYFIRST 11
#define TRANSACT2_FINDNOTIFYNEXT 12
#define TRANSACT2_MKDIR 13
#define TRANSACT2_MKDIR 13 /* TRANS2_CREATE_DIRECTORY */
/* These are used by SMBntcreateX */
#define FILE_READ_DATA 0x00000001
#define FILE_WRITE_DATA 0x00000002
#define FILE_READ_ATTRIBUTES 0x00000080
#define FILE_WRITE_ATTRIBUTES 0x00000100
#define FILE_DELETE 0x00001000
#define GENERIC_WRITE 0x40000000
#define GENERIC_READ 0x80000000
#define FILE_SHARE_READ 0x00000001
#define FILE_SHARE_WRITE 0x00000002
#define SEC_ANONYMOUS 0x00000000
#define FILE_OPEN 0x00000001
#define FILE_CREATE 0x00000002
#define FILE_OVERWRITE_IF 0x00000005
#define NT_CREATE_REQUEST_OPBATCH 0x00000004
/* Directory entry formats supported by TRANSACT2_FINDFIRST/TRANSACT2_FINDNEXT */
#define SMB_INFO_STANDARD 0x0001 /* LAN Manager 2.0 */
#define SMB_FILE_BOTH_DIRECTORY_INFO 0x0104 /* NT LAN Manager */
/* File system information formats supported by TRANSACT2_QFSINFO (actually,
* we only need this one).
*/
#define SMB_QUERY_FS_SIZE_INFO 0x0103
/* Path information formats supported by TRANSACT2_QPATHINFO and TRANSACT2_QFILEINFO. */
#define SMB_QUERY_FILE_ALL_INFO 0x0107
/* Set information formats supported by TRANSACT2_SETFILEINFO. */
#define SMB_SET_FILE_BASIC_INFO 0x0101 /* NT LAN Manager */
#define SMB_SET_FILE_END_OF_FILE_INFO 0x0104 /* NT LAN Manager */
#endif /* _SMBNO_H_ */