-/*
+/*
Copyright (c) 1995-1998 by Cisco systems, Inc.
Permission to use, copy, modify, and distribute this software for
FITNESS FOR A PARTICULAR PURPOSE.
*/
+
#include "tac_plus.h"
+#include <stdlib.h>
+#include <netinet/in.h> /* for ntohl() */
+
+#include "acct.h"
+#include "report.h"
+#include "packet.h"
+#include "utils.h"
+#include "do_acct.h"
+#include "main.h"
+#include "do_author.h" /* for "struct identity" */
+#include "cfgfile.h"
+
+#ifdef MAXSESS
+#include "maxsess.h"
+#endif
+#ifdef DB
+#include "db.h"
+#endif
+
+
+static void account TAC_ARGS((u_char *pak));
+
+
/*
* Come here when we receive an Start Accounting packet
*/
-void account();
-
-/* For DB accounting */
-#ifdef DB
-int db_acct();
-#endif /* DB */
+void accounting TAC_ARGS((u_char *pak));
void
accounting(pak)
struct acct *acct_pak;
u_char *p;
HDR *hdr;
- u_char *read_packet();
- int i, len;
+ int i;
+ unsigned long len;
if (debug & DEBUG_ACCT_FLAG)
report(LOG_DEBUG, "Start accounting request");
/* Length checks */
len = TAC_ACCT_REQ_FIXED_FIELDS_SIZE;
- len += acct_pak->user_len + acct_pak->port_len +
+ len += acct_pak->user_len + acct_pak->port_len +
acct_pak->rem_addr_len + acct_pak->arg_cnt;
for (i = 0; i < (int)acct_pak->arg_cnt; i++) {
len += p[i];
}
- if (len != ntohl(hdr->datalength)) {
+ if (len != (unsigned long) ntohl(hdr->datalength)) {
send_error_reply(TAC_PLUS_ACCT, NULL);
return;
}
free(pak);
}
-void
+static void account TAC_ARGS((u_char *pak));
+
+static void
account(pak)
u_char *pak;
{
identity.priv_lvl = acct_pak->priv_lvl;
+ cfg_request_identity(&identity);
+
rec.identity = &identity;
/* Now process cmd args */
errors = do_wtmp(&rec);
} else {
errors = do_acct(&rec);
-#ifdef DB
+#ifdef DB
if (session.db_acct && rec.acct_type==ACCT_TYPE_STOP )
db_acct(&rec);
#endif
for (i = 0; i < (int)acct_pak->arg_cnt; i++) {
free(cmd_argp[i]);
- }
+ }
free(cmd_argp);
-
+
if (rec.msg)
free(rec.msg);
if (rec.admin_msg)