Skip to content

Commit

Permalink
Fix tacacs local accounting break. (sonic-net#18357)
Browse files Browse the repository at this point in the history
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, 
sonic-net#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.
  • Loading branch information
liuh-80 committed May 24, 2024
1 parent ca0c815 commit fc2929d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tacacs/audisp/patches/0003-Add-local-accounting.patch
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ index 0000000..e23acec
+#include "trace.h"
+
+/* 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. */
+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
diff --git a/local_accounting.h b/local_accounting.h
Expand Down

0 comments on commit fc2929d

Please sign in to comment.