version 1.1.1.1.4.1, 2014/06/15 16:39:18
|
version 1.1.1.1.4.2, 2014/07/30 09:05:19
|
Line 38
|
Line 38
|
#include <sys/socket.h> |
#include <sys/socket.h> |
#include <sys/queue.h> |
#include <sys/queue.h> |
|
|
#include <utmp.h> | #include <utmpx.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 utmp ut; | struct utmpx 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 1671 isakmp_cfg_accounting_system(port, raddr, usr, inout)
|
Line 1670 isakmp_cfg_accounting_system(port, raddr, usr, inout)
|
return -1; |
return -1; |
} |
} |
|
|
sprintf(term, TERMSPEC, port); | memset(&ut, 0, sizeof ut); |
| 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: |
strncpy(ut.ut_name, usr, UT_NAMESIZE); | ut.ut_type = USER_PROCESS; |
ut.ut_name[UT_NAMESIZE - 1] = '\0'; | strncpy(ut.ut_user, usr, sizeof ut.ut_user); |
|
|
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, UT_HOSTSIZE); | strncpy(ut.ut_host, addr, sizeof ut.ut_host); |
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_name, ut.ut_line, ut.ut_host); | ut.ut_user, ut.ut_id, addr); |
|
|
login(&ut); | pututxline(&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, term); | usr, ut.ut_id); |
|
|
logout(term); | pututxline(&ut); |
|
|
break; |
break; |
default: |
default: |