summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_smb_traffic_analyzer.c
AgeCommit message (Collapse)AuthorFilesLines
2010-06-03s3: remove unused librpc/ndr/sid.c.Günther Deschner1-0/+1
Guenther
2010-06-01s3-vfs: Send the share name instead of the path in smb_traffic_analyzer.Holger Hetterich1-2/+5
In protocol v2, the name of the service should be sent instead of the path. Signed-off-by: Andreas Schneider <asn@samba.org>
2010-05-28s3:auth use info3 in auth_serversupplied_infoSimo Sorce1-3/+3
Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-27vfs_smb_traffic_analyzer.c: set the len variable when running protocol v1.Holger Hetterich1-0/+1
Signed-off-by: Andreas Schneider <asn@samba.org>
2010-03-25s3: vfs_smb_traffic_analyzer.c: remove warnings from developer buildHolger Hetterich1-14/+16
This patch should remove all warnings coming up when compiling traffic analyzer with configure.developer. Re-activate the smb_traffic_analyzer_rmdir function by adding it's vfs_fn_pointer to vfs_smb_traffic_analyzer_fns. Copy the mode_t used in smb_traffic_analyzer_open to the corresponding data structure.
2010-03-16s3-vfs: fix some buildwarnings in traffic analyzer, there are many more.Günther Deschner1-9/+11
Holger, please check. Guenther
2010-03-16Update copyrightJim McDonough1-1/+1
2010-03-16s3: vfs_smb_traffic_analyzer.c: add VFS functions for file open and closeHolger Hetterich1-1/+51
2010-03-16smb_traffic_analyzer.c: optimize marshalling function and documentHolger Hetterich1-33/+53
Collect all data that is needed, and use only one talloc_asprintf operation to create the string of common data. This simplifies the code a bit and is most probably faster than the old method. Also, #define SMBTA_COMMON_DATA_COUNT as a complete string, speeding things up because we know the value at compile time.
2010-03-16vfs_smb_traffic_analyzer.c: added functionHolger Hetterich1-63/+58
static char *smb_traffic_analyzer_anonymize This takes a lot of code out of the main functions, and makes it a bit simpler. Do the anonymization in a function. Since we already anonymized the username we don't need to do this a second time in the v2 marshalling function.
2010-03-16Simplify the code a bit by creating the functions:Holger Hetterich1-84/+123
smb_traffic_analyzer_encrypt - doing the encryption of a data block, smb_traffic_analyzer_create_header - create the protocol header, smb_traffic_analyzer_write_data - actually write the data to the socket.
2010-03-16Add the number of common data blocks to the protocol.Holger Hetterich1-4/+23
Always send the number of common data blocks first. This way, we can make the protocol backwards compatible. A receiver running with an older subprotocol can just ignore if a newer sender sends more common data. Add a few remarks to the marshalling function. Add two #define lines defining the protocol subrelease number and the number of common data blocks to the header file.
2010-03-16Put all the protocol stuff into a separate header file.Holger Hetterich1-114/+12
All the structures and the vfs function identifier list is required by the receiver. It's therefore very handy to have this in an extra header file.
2010-03-16Add smbta-util to manage the encryption key.Holger Hetterich1-0/+1
This program allows the administrator to enable or disable AES encryption when using vfs_smb_traffic_analyzer. It also generates new keys, stores them to a file, so that the file can be reused on another client or server.
2010-03-16Implement AES encryption of the data block.Holger Hetterich1-13/+33
First try. This runs on 16 bytes long AES block size, and enlarges the data block with 16 bytes, to make sure all bytes are in. The added bytes are filled with '.'. It then creates a header featuring the new length to be send, and finally sends the data block, then returns. This code is untested, as creating the receiver will be my next step. To simplify traffic_analyzer's code, this code should run as a function. It's on the do-to-list.
2010-03-16Implement anonymization for protocol v2.Holger Hetterich1-14/+53
Since we need to care for the SID too, do the anonymization in the marshalling function and anonymize both the username and the SID. Remove the 'A' status flag from the header definition. A listener could see from the unencrypted header if the module is anonymizing or not, which is certainly not wanted.
2010-03-16Make all remarks compatible to the linux kernel coding styleguide.Holger Hetterich1-27/+33
2010-03-16Added an exact description of the V2 protocol.Holger Hetterich1-0/+62
I don't think it should have it's place the man page, because this is developer information.
2010-03-16Move the creation of the header.Holger Hetterich1-11/+37
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-16Fetch the SID of the user we are running as and send with the commonHolger Hetterich1-2/+5
data.
2010-03-16Additionally send the vfs function id with the protocol.Holger Hetterich1-7/+11
2010-03-16According to the linux kernel coding styleguide, it's better toHolger Hetterich1-46/+46
align the switch and it's case statements in the same column. This saves us one indentation level.
2010-03-16Don't use typedefs on the VFS function data structures asHolger Hetterich1-27/+27
typedefs are evil according to the linux kernel coding styleguide.
2010-03-16Add read,pread,write,pwrite support to the V2 protocol.Holger Hetterich1-3/+14
2010-03-16Enable AES encryption of the data if a key was found in secrets.tdb.Holger Hetterich1-3/+22
2010-03-16Add rmdir, chdir, and rename as supported VFS functionsHolger Hetterich1-9/+87
2010-03-16The format of data we are sending over the network will be flexible when ↵Holger Hetterich1-4/+74
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-16Create structs carrying the data of individual VFS functions, and hand those ↵Holger Hetterich1-33/+47
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-16Introduce smb_traffic_analyzer protocol v2.Holger Hetterich1-7/+62
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.
2009-11-30Restructure the connect function code to always callJeremy Allison1-1/+9
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-07-24Make the smbd VFS typesafeVolker Lendecke1-17/+9
2009-07-20s3: Finish plumbing the fsp->fsp_name smb_fname conversion through the modules.Tim Prouty1-8/+10
2009-02-13Enable total anonymization in vfs_smb_traffic_analyzer, by mapping any user ↵Holger Hetterich1-5/+16
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-01-04Async wrapper for open_socket_out_send/recvVolker Lendecke1-2/+3
2009-01-03open_socket_out is always used with SOCK_STREAM, remove argument "type"Volker Lendecke1-1/+1
2008-10-29Fix CID 606 - failed to return -1 after socket() fail.Jeremy Allison1-0/+1
Jeremy.
2008-10-13Whitespace tidyup and an optimization to remove a talloc.Jeremy Allison1-7/+5
Jeremy.
2008-10-13Enable optional anonymization of user names,Holger Hetterich1-1/+24
if the configuration parameter anonymization_prefix is defined in smb.conf, and use the prefix given there.
2008-10-06Fixed build warning "passing arg from incompatible pointer type"Tim Prouty1-1/+3
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-01Turn the socket connections into a refcounted list - in the common case ↵Jeremy Allison1-44/+95
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-09-30Convert to allocated strings. Use write_data(), not send as this doesn't ↵Jeremy Allison1-58/+42
correctly deal with EINTR. Jim and Holger please check this still works. Jeremy.
2008-09-30Remove current_user_info - not needed.Jeremy Allison1-4/+2
Jeremy.
2008-09-30Restructure the module so it connects to the remote data sinkJeremy Allison1-150/+156
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-25Use IPv4/v6 independent calls. Change safe_strcpy/cat to strlcpy/cat (thisJeremy Allison1-84/+97
needs changing to talloc_sprintf) and fix file descriptor resource leaks in error paths. Jim and Holger please check ! Jeremy.
2008-09-24Fix the new vfs_smb_traffic_analyzer build for static linksJim McDonough1-2/+2
2008-09-24SMB traffic analyzer vfs module from Holger Hetterich <hhetter@novell.com>Holger Hetterich1-0/+352
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).