version 1.1.1.1, 2012/02/21 22:39:10
|
version 1.1.1.1.4.1, 2014/06/15 16:39:18
|
Line 38
|
Line 38
|
#include <sys/socket.h> |
#include <sys/socket.h> |
#include <sys/queue.h> |
#include <sys/queue.h> |
|
|
#include <utmpx.h> | #include <utmp.h> |
#if defined(__APPLE__) && defined(__MACH__) |
#if defined(__APPLE__) && defined(__MACH__) |
#include <util.h> |
#include <util.h> |
#endif |
#endif |
Line 1661 isakmp_cfg_accounting_system(port, raddr, usr, inout)
|
Line 1661 isakmp_cfg_accounting_system(port, raddr, usr, inout)
|
int inout; |
int inout; |
{ |
{ |
int error = 0; |
int error = 0; |
struct utmpx ut; | struct utmp ut; |
| char term[UT_LINESIZE]; |
char addr[NI_MAXHOST]; |
char addr[NI_MAXHOST]; |
|
|
if (usr == NULL || usr[0]=='\0') { |
if (usr == NULL || usr[0]=='\0') { |
Line 1670 isakmp_cfg_accounting_system(port, raddr, usr, inout)
|
Line 1671 isakmp_cfg_accounting_system(port, raddr, usr, inout)
|
return -1; |
return -1; |
} |
} |
|
|
memset(&ut, 0, sizeof ut); | sprintf(term, TERMSPEC, port); |
gettimeofday((struct timeval *)&ut.ut_tv, NULL); | |
snprintf(ut.ut_id, sizeof ut.ut_id, TERMSPEC, port); | |
|
|
switch (inout) { |
switch (inout) { |
case ISAKMP_CFG_LOGIN: |
case ISAKMP_CFG_LOGIN: |
ut.ut_type = USER_PROCESS; | strncpy(ut.ut_name, usr, UT_NAMESIZE); |
strncpy(ut.ut_user, usr, sizeof ut.ut_user); | ut.ut_name[UT_NAMESIZE - 1] = '\0'; |
|
|
|
strncpy(ut.ut_line, term, UT_LINESIZE); |
|
ut.ut_line[UT_LINESIZE - 1] = '\0'; |
|
|
GETNAMEINFO_NULL(raddr, addr); |
GETNAMEINFO_NULL(raddr, addr); |
strncpy(ut.ut_host, addr, sizeof ut.ut_host); | strncpy(ut.ut_host, addr, UT_HOSTSIZE); |
| ut.ut_host[UT_HOSTSIZE - 1] = '\0'; |
|
|
|
ut.ut_time = time(NULL); |
|
|
plog(LLV_INFO, LOCATION, NULL, |
plog(LLV_INFO, LOCATION, NULL, |
"Accounting : '%s' logging on '%s' from %s.\n", |
"Accounting : '%s' logging on '%s' from %s.\n", |
ut.ut_user, ut.ut_id, addr); | ut.ut_name, ut.ut_line, ut.ut_host); |
|
|
pututxline(&ut); | login(&ut); |
|
|
break; |
break; |
case ISAKMP_CFG_LOGOUT: |
case ISAKMP_CFG_LOGOUT: |
ut.ut_type = DEAD_PROCESS; |
|
|
|
plog(LLV_INFO, LOCATION, NULL, |
plog(LLV_INFO, LOCATION, NULL, |
"Accounting : '%s' unlogging from '%s'.\n", |
"Accounting : '%s' unlogging from '%s'.\n", |
usr, ut.ut_id); | usr, term); |
|
|
pututxline(&ut); | logout(term); |
|
|
break; |
break; |
default: |
default: |