Fix tacacs local accounting break. (#18357)

Fix TACACS local accounting disabled when debug flag disabled.

#### Why I did it
TACACS local accounting use trace() method to output local accounting log, following PR disable trace log when debug flag disabled, 
https://github.com/sonic-net/sonic-buildimage/pull/16482

Because test case issue, this regression not found. the issue only exists on master branch.

### How I did it
Fix TACACS local accounting disabled when debug flag disabled.

#### How to verify it
Pass all UT.
Fix TACACS accounting UT to prevent regression.

### Tested branch (Please provide the tested image version)

- [] SONiC.master-16482.360728-2c8b4066f

#### Description for the changelog
Fix TACACS local accounting disabled when debug flag disabled.
This commit is contained in:
Hua Liu 2024-03-21 12:28:39 +08:00 committed by GitHub
parent 371f6a6835
commit 4cbb559fd1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -70,12 +70,12 @@ index 0000000..e23acec
+#include "trace.h" +#include "trace.h"
+ +
+/* Accounting log format. */ +/* Accounting log format. */
+#define ACCOUNTING_LOG_FORMAT "Accounting: user: %s, tty: %s, host: %s, command: %s, type: %d, task ID: %d" +#define ACCOUNTING_LOG_FORMAT "Audisp-tacplus: Accounting: user: %s, tty: %s, host: %s, command: %s, type: %d, task ID: %d"
+ +
+/* Write the accounting information to syslog. */ +/* Write the accounting information to syslog. */
+void accounting_to_syslog(char *user, char *tty, char *host, char *cmdmsg, int type, uint16_t task_id) +void accounting_to_syslog(char *user, char *tty, char *host, char *cmdmsg, int type, uint16_t task_id)
+{ +{
+ trace(ACCOUNTING_LOG_FORMAT, user, tty, host, cmdmsg, type, task_id); + syslog(LOG_INFO, ACCOUNTING_LOG_FORMAT, user, tty, host, cmdmsg, type, task_id);
+} +}
\ No newline at end of file \ No newline at end of file
diff --git a/local_accounting.h b/local_accounting.h diff --git a/local_accounting.h b/local_accounting.h