summaryrefslogtreecommitdiffstats
path: root/source/modules
diff options
context:
space:
mode:
authorHolger Hetterich <hhetter@novell.com>2008-10-13 14:09:07 -0700
committerKarolin Seeger <kseeger@samba.org>2008-10-15 18:10:30 +0200
commit35bb309d1b120851d987f762ca310673892df2c7 (patch)
treed00a7f5638d6d39a440e2ec8e2c7a9d61df7ca04 /source/modules
parenta862604b9c9afe48609a3c94c6c484baf19aea82 (diff)
downloadsamba-35bb309d1b120851d987f762ca310673892df2c7.tar.gz
samba-35bb309d1b120851d987f762ca310673892df2c7.tar.xz
samba-35bb309d1b120851d987f762ca310673892df2c7.zip
Enable optional anonymization of user names,
if the configuration parameter anonymization_prefix is defined in smb.conf, and use the prefix given there. (cherry picked from commit 84355feee9a718e8ffe854df1129461d65d114dc)
Diffstat (limited to 'source/modules')
-rw-r--r--source/modules/vfs_smb_traffic_analyzer.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/source/modules/vfs_smb_traffic_analyzer.c b/source/modules/vfs_smb_traffic_analyzer.c
index 9b4c1b3e255..be77fc49e02 100644
--- a/source/modules/vfs_smb_traffic_analyzer.c
+++ b/source/modules/vfs_smb_traffic_analyzer.c
@@ -42,6 +42,7 @@ static enum sock_type smb_traffic_analyzer_connMode(vfs_handle_struct *handle)
}
}
+
/* Connect to an internet socket */
static int smb_traffic_analyzer_connect_inet_socket(vfs_handle_struct *handle,
@@ -160,6 +161,8 @@ static void smb_traffic_analyzer_send_data(vfs_handle_struct *handle,
struct tm *tm = NULL;
int seconds;
char *str = NULL;
+ char *username = NULL;
+ const char *anon_prefix = NULL;
size_t len;
SMB_VFS_HANDLE_GET_DATA(handle, rf_sock, struct refcounted_sock, return);
@@ -178,11 +181,31 @@ static void smb_traffic_analyzer_send_data(vfs_handle_struct *handle,
}
seconds=(float) (tv.tv_usec / 1000);
+ /* check if anonymization is required */
+
+ anon_prefix=lp_parm_const_string(SNUM(handle->conn),"smb_traffic_analyzer",\
+ "anonymize_prefix", NULL );
+ if (anon_prefix!=NULL) {
+ username = talloc_asprintf(talloc_tos(),
+ "%s%i",
+ anon_prefix,
+ str_checksum(
+ handle->conn->server_info->sanitized_username ) );
+ } else {
+ username = talloc_asprintf(talloc_tos(),
+ "%s",
+ handle->conn->server_info->sanitized_username);
+ }
+
+ if (!username) {
+ return;
+ }
+
str = talloc_asprintf(talloc_tos(),
"V1,%u,\"%s\",\"%s\",\"%c\",\"%s\",\"%s\","
"\"%04d-%02d-%02d %02d:%02d:%02d.%03d\"\n",
(unsigned int)result,
- handle->conn->server_info->sanitized_username,
+ username,
pdb_get_domain(handle->conn->server_info->sam_account),
Write ? 'W' : 'R',
handle->conn->connectpath,