summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hetterich <hhetter@novell.com>2008-10-13 14:14:25 -0700
committerKarolin Seeger <kseeger@samba.org>2008-10-15 18:51:04 +0200
commite9359e6e8f692c693aad95f9a241c41cc23aa02a (patch)
treecfa2f4b4ba61992fb9c43b1cf75bf15c20216d20
parent41b2199fd87598076a1f45106b512c94042f7968 (diff)
downloadsamba-e9359e6e8f692c693aad95f9a241c41cc23aa02a.tar.gz
samba-e9359e6e8f692c693aad95f9a241c41cc23aa02a.tar.xz
samba-e9359e6e8f692c693aad95f9a241c41cc23aa02a.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 86a621a1a3e08bad8a0b276d8444f1f69a500385)
-rw-r--r--source/modules/vfs_smb_traffic_analyzer.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/source/modules/vfs_smb_traffic_analyzer.c b/source/modules/vfs_smb_traffic_analyzer.c
index 1402b7c6224..a4e3a3bda1a 100644
--- a/source/modules/vfs_smb_traffic_analyzer.c
+++ b/source/modules/vfs_smb_traffic_analyzer.c
@@ -43,6 +43,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,
@@ -161,6 +162,8 @@ static void smb_traffic_analyzer_send_data(vfs_handle_struct *handle,
struct tm *tm = NULL;
int seconds;
char *str = NULL;
+ const char *username = NULL;
+ const char *anon_prefix = NULL;
size_t len;
SMB_VFS_HANDLE_GET_DATA(handle, rf_sock, struct refcounted_sock, return);
@@ -179,11 +182,27 @@ 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(get_current_username()));
+ } else {
+ username = get_current_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,
- get_current_username(),
+ username,
current_user_info.domain,
Write ? 'W' : 'R',
handle->conn->connectpath,