summaryrefslogtreecommitdiff
path: root/auth
diff options
context:
space:
mode:
authorJoseph Sutton <josephsutton@catalyst.net.nz>2023-05-16 09:53:02 +1200
committerAndrew Bartlett <abartlet@samba.org>2023-05-18 01:03:37 +0000
commit4440f1db54b7ad54b7a4920ac67236d1d8605353 (patch)
tree6895220fdde9d7af80f8466780d4754fdf21e655 /auth
parent89d30cdfe164e441d0b565e02ea9422eaae789fb (diff)
downloadsamba-4440f1db54b7ad54b7a4920ac67236d1d8605353.tar.gz
lib:audit_logging: Add function to add flags to a JSON message
This replaces a couple of calls to snprintf() in log_authentication_event_json() and log_successful_authz_event_json() respectively. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'auth')
-rw-r--r--auth/auth_log.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/auth/auth_log.c b/auth/auth_log.c
index 730e5b6080e..c0506823008 100644
--- a/auth/auth_log.c
+++ b/auth/auth_log.c
@@ -149,7 +149,6 @@ static void log_authentication_event_json(
{
struct json_object wrapper = json_empty_object;
struct json_object authentication = json_empty_object;
- char negotiate_flags[11];
char logon_id[19];
int rc = 0;
const char *clientDomain = ui->orig_client.domain_name ?
@@ -257,12 +256,9 @@ static void log_authentication_event_json(
if (rc != 0) {
goto failure;
}
- snprintf(negotiate_flags,
- sizeof( negotiate_flags),
- "0x%08X",
- ui->netlogon_trust_account.negotiate_flags);
- rc = json_add_string(
- &authentication, "netlogonNegotiateFlags", negotiate_flags);
+ rc = json_add_flags32(
+ &authentication, "netlogonNegotiateFlags",
+ ui->netlogon_trust_account.negotiate_flags);
if (rc != 0) {
goto failure;
}
@@ -368,7 +364,6 @@ static void log_successful_authz_event_json(
{
struct json_object wrapper = json_empty_object;
struct json_object authorization = json_empty_object;
- char account_flags[11];
int rc = 0;
authorization = json_new_object();
@@ -426,12 +421,7 @@ static void log_successful_authz_event_json(
if (rc != 0) {
goto failure;
}
-
- snprintf(account_flags,
- sizeof(account_flags),
- "0x%08X",
- session_info->info->acct_flags);
- rc = json_add_string(&authorization, "accountFlags", account_flags);
+ rc = json_add_flags32(&authorization, "accountFlags", session_info->info->acct_flags);
if (rc != 0) {
goto failure;
}