diff options
author | Andrew Bartlett <abartlet@samba.org> | 2018-06-10 13:00:34 +0200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2018-06-25 08:32:14 +0200 |
commit | 1bb2a1c6b3eaccf114ac3f3b5b51f57828a04996 (patch) | |
tree | f9e2d830408870f90254129a64d678198e978971 /source3/auth | |
parent | 05b54cc259645f69e14de2703724c284ed25838c (diff) | |
download | samba-1bb2a1c6b3eaccf114ac3f3b5b51f57828a04996.tar.gz |
auth: For NTLM and KDC authentication, log the authentication duration
This is not a general purpose profiling solution, but these JSON logs are already being
generated and stored, so this is worth adding.
Some administrators are very keen to know how long authentication
takes, particularly due to long replication transactions in other
processes.
This complements a similar patch set to log the transaction duration.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Diffstat (limited to 'source3/auth')
-rw-r--r-- | source3/auth/auth.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/source3/auth/auth.c b/source3/auth/auth.c index e0011a47eb3..d13d0fe471c 100644 --- a/source3/auth/auth.c +++ b/source3/auth/auth.c @@ -300,7 +300,9 @@ NTSTATUS auth_check_ntlm_password(TALLOC_CTX *mem_ctx, } log_authentication_event(NULL, NULL, - user_info, nt_status, + &auth_context->start_time, + user_info, + nt_status, server_info->info3->base.logon_domain.string, server_info->info3->base.account_name.string, unix_username, &sid); @@ -331,7 +333,15 @@ fail: user_info->client.account_name, user_info->mapped.account_name, nt_errstr(nt_status), *pauthoritative)); - log_authentication_event(NULL, NULL, user_info, nt_status, NULL, NULL, NULL, NULL); + log_authentication_event(NULL, + NULL, + &auth_context->start_time, + user_info, + nt_status, + NULL, + NULL, + NULL, + NULL); ZERO_STRUCTP(pserver_info); @@ -373,6 +383,8 @@ static NTSTATUS make_auth_context(TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } + ctx->start_time = timeval_current(); + talloc_set_destructor((TALLOC_CTX *)ctx, auth_context_destructor); *auth_context = ctx; |