1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

29 Commits

Author SHA1 Message Date
Holger Hetterich
81c6b878b1 Added an exact description of the V2 protocol.
I don't think it should have it's place the man page, because this is
developer information.
2010-03-16 09:52:09 -04:00
Holger Hetterich
a45db59480 Move the creation of the header.
Since the header block of the protocol contains the number of bytes to
come, we always send the header itself unmodified.
If we compress or crypt the data we are about to send, the length of the
data to send may change. Therefore, we no longer create the header in
smb_traffic_analyzer_create_string, but shortly before we send the data.
For both cases, encryption and normal, we create our own header, and
send it before the actual data.

In case of protocol v1, we don't need to create an extra header.
Just send the data, and return from the function.
Change a debug message to say that the header for crypted data has
been created.

Add a status flags consisting of 6 bytes to the header. Their function
will be descriped in one of the next patches, which is descriping
the header in a longer comment.
When anonymization and/or encryption is used, set the flags accordingly.
2010-03-16 09:52:09 -04:00
Holger Hetterich
9702dcfa91 Fetch the SID of the user we are running as and send with the common
data.
2010-03-16 09:52:09 -04:00
Holger Hetterich
654cff4cc3 Additionally send the vfs function id with the protocol. 2010-03-16 09:52:09 -04:00
Holger Hetterich
27f4f51d56 According to the linux kernel coding styleguide, it's better to
align the switch and it's case statements in the same column.
This saves us one indentation level.
2010-03-16 09:52:09 -04:00
Holger Hetterich
cdd1906728 Don't use typedefs on the VFS function data structures as
typedefs are evil according to the linux kernel coding
styleguide.
2010-03-16 09:52:09 -04:00
Holger Hetterich
8cb5bac9ee Add read,pread,write,pwrite support to the V2 protocol. 2010-03-16 09:52:09 -04:00
Holger Hetterich
541fb436cc Enable AES encryption of the data if a key was found in secrets.tdb. 2010-03-16 09:52:09 -04:00
Holger Hetterich
7bff1eabe5 Add rmdir, chdir, and rename as supported VFS functions 2010-03-16 09:52:09 -04:00
Holger Hetterich
e959bdcca4 The format of data we are sending over the network will be flexible when sending over the network in protocol v2. To be able to do this, we create a new va-list function that is creating the buffer to send. Also it makes it easier for the receiver to parse the data; it sends an initial header containing the full length of the buffer to be send. For the individual strings, it sends sub headers containing the length of the upcoming substring to be send. With the header-data-header-data [..] structure we don't need to quote the sub strings finally enabling having all possible character sets in filenames etc..
In the sending function, implement mkdir to actually send it's data
for testing.
2010-03-16 09:52:08 -04:00
Holger Hetterich
dcff7d3672 Create structs carrying the data of individual VFS functions, and hand those over to the send function, which then casts the void pointer to the struct required by looking at the id. This allows us to return different result data depending on the VFS function that is running. Make the protocol v1 sender compatible to this. Adapt the existing VFS functions to use the new data structures. Make use of the new functionality and extend the mkdir VFS logger function to return the creation mode additionally. 2010-03-16 09:52:08 -04:00
Holger Hetterich
2a643ef10c Introduce smb_traffic_analyzer protocol v2.
From Holger:
Make smb_traffic_analyzer differ the protocol versions to enable the development of version 2 of the protocol. To do this, a new parameter "protocol_version" has been introduced, which can be set to "V1", "V2", or nothing. If protocol_version is not set, V1 will be chosen automatically.

Created an enum for identifying VFS functions in the upcoming protocol v2. Converted the existing VFS functions to use the identifier, and set the read/write bool used in protocol v1 accordingly, also ignore any other VFS functions except read/write/pread/pwrite in v1. Added a first new VFS function for mkdir, which I use for testing and implementing both the sender and receiver for v2.
2010-03-16 09:52:08 -04:00
Jeremy Allison
8303bc49a4 Restructure the connect function code to always call
down to NEXT-> before initializing. This allows us to
do cleanup (by calling DISCONNECT) if initialization
fails. Also fix vfs_acl_xattr which was failing to
call the NEXT connect function.
Jeremy.
2009-11-30 15:53:04 -08:00
Volker Lendecke
033185e2a1 Make the smbd VFS typesafe 2009-07-24 11:42:05 -04:00
Tim Prouty
c9b8a01714 s3: Finish plumbing the fsp->fsp_name smb_fname conversion through the modules. 2009-07-20 17:26:57 -07:00
Holger Hetterich
4261cae2eb Enable total anonymization in vfs_smb_traffic_analyzer, by mapping any user names to the one given by anonymize_prefix, without generating a hash number. This setting is optional and is compatible with the module configuration format of Samba 3.3. 2009-02-13 17:22:25 -08:00
Volker Lendecke
19b783cce9 Async wrapper for open_socket_out_send/recv 2009-01-04 16:42:40 +01:00
Volker Lendecke
fafb9ecc61 open_socket_out is always used with SOCK_STREAM, remove argument "type" 2009-01-03 19:22:06 +01:00
Jeremy Allison
680975d07b Fix CID 606 - failed to return -1 after socket() fail.
Jeremy.
2008-10-29 16:43:19 -07:00
Jeremy Allison
2a2f9400bf Whitespace tidyup and an optimization to remove a talloc.
Jeremy.
2008-10-13 14:12:43 -07:00
Holger Hetterich
3e1d6c6020 Enable optional anonymization of user names,
if the configuration parameter anonymization_prefix is defined in
smb.conf, and use the prefix given there.
2008-10-13 14:08:49 -07:00
Tim Prouty
cde1b09d68 Fixed build warning "passing arg from incompatible pointer type"
The fix explicitly makes the conversion from timeval to time_t using the
existing time utility functions.

Compiling modules/vfs_smb_traffic_analyzer.c
modules/vfs_smb_traffic_analyzer.c: In function `smb_traffic_analyzer_send_data':
modules/vfs_smb_traffic_analyzer.c:173: warning: passing arg 1 of `localtime' from incompatible pointer type
2008-10-06 17:18:10 -07:00
Jeremy Allison
370cbe0060 Turn the socket connections into a refcounted list - in the common case there'll now only be one socket per smbd.
Changed the format of the wire data to (a) include a version number (V1) as the first element. (b) removed the
";)" at the end an replaced it with a "\n". Receiver can change back if needed, and now receiver can just log
"as-is" to a text file (making testing easier). Added my (C). Sorry Holger, but I've changed quite a bit now.
Jeremy.
2008-10-01 12:50:29 -07:00
Jeremy Allison
c164ff2be5 Convert to allocated strings. Use write_data(), not send as this doesn't correctly
deal with EINTR. Jim and Holger please check this still works.
Jeremy.
2008-09-30 16:19:37 -07:00
Jeremy Allison
4e6445a072 Remove current_user_info - not needed.
Jeremy.
2008-09-30 15:21:58 -07:00
Jeremy Allison
321191d5e2 Restructure the module so it connects to the remote data sink
on connect, and closes the socket on client disconnect. This should
make it much more efficient. Store the remote fd in a private data
pointer off the handle. Finally we need to remove the fstrings and
convert to allocated buffer storage.
Jeremy.
2008-09-30 15:13:19 -07:00
Jeremy Allison
da6c7aa2a1 Use IPv4/v6 independent calls. Change safe_strcpy/cat to strlcpy/cat (this
needs changing to talloc_sprintf) and fix file descriptor resource leaks
in error paths. Jim and Holger please check !
Jeremy.
2008-09-25 12:02:22 -07:00
Jim McDonough
a78ac8a46b Fix the new vfs_smb_traffic_analyzer build for static links 2008-09-24 20:51:04 -04:00
Holger Hetterich
964fb9f249 SMB traffic analyzer vfs module from Holger Hetterich <hhetter@novell.com>
Used to gather data to feed to a database for live and historical
analysis of usage per user, per share, etc.

Helper apps to read the data still to come.  This one still needs to be
made ipv6 enabled (connection is made to the helper app).
2008-09-24 19:16:57 -04:00