You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.7 KiB

  1. --- a/src/racoon/isakmp_cfg.c
  2. +++ b/src/racoon/isakmp_cfg.c
  3. @@ -38,7 +38,7 @@
  4. #include <sys/socket.h>
  5. #include <sys/queue.h>
  6. -#include <utmpx.h>
  7. +#include <utmp.h>
  8. #if defined(__APPLE__) && defined(__MACH__)
  9. #include <util.h>
  10. #endif
  11. @@ -1661,7 +1661,8 @@ isakmp_cfg_accounting_system(port, raddr
  12. int inout;
  13. {
  14. int error = 0;
  15. - struct utmpx ut;
  16. + struct utmp ut;
  17. + char term[UT_LINESIZE];
  18. char addr[NI_MAXHOST];
  19. if (usr == NULL || usr[0]=='\0') {
  20. @@ -1670,34 +1671,37 @@ isakmp_cfg_accounting_system(port, raddr
  21. return -1;
  22. }
  23. - memset(&ut, 0, sizeof ut);
  24. - gettimeofday((struct timeval *)&ut.ut_tv, NULL);
  25. - snprintf(ut.ut_id, sizeof ut.ut_id, TERMSPEC, port);
  26. + sprintf(term, TERMSPEC, port);
  27. switch (inout) {
  28. case ISAKMP_CFG_LOGIN:
  29. - ut.ut_type = USER_PROCESS;
  30. - strncpy(ut.ut_user, usr, sizeof ut.ut_user);
  31. + strncpy(ut.ut_name, usr, UT_NAMESIZE);
  32. + ut.ut_name[UT_NAMESIZE - 1] = '\0';
  33. +
  34. + strncpy(ut.ut_line, term, UT_LINESIZE);
  35. + ut.ut_line[UT_LINESIZE - 1] = '\0';
  36. GETNAMEINFO_NULL(raddr, addr);
  37. - strncpy(ut.ut_host, addr, sizeof ut.ut_host);
  38. + strncpy(ut.ut_host, addr, UT_HOSTSIZE);
  39. + ut.ut_host[UT_HOSTSIZE - 1] = '\0';
  40. +
  41. + ut.ut_time = time(NULL);
  42. plog(LLV_INFO, LOCATION, NULL,
  43. "Accounting : '%s' logging on '%s' from %s.\n",
  44. - ut.ut_user, ut.ut_id, addr);
  45. -
  46. - pututxline(&ut);
  47. + ut.ut_name, ut.ut_line, ut.ut_host);
  48. + login(&ut);
  49. +
  50. break;
  51. case ISAKMP_CFG_LOGOUT:
  52. - ut.ut_type = DEAD_PROCESS;
  53. plog(LLV_INFO, LOCATION, NULL,
  54. "Accounting : '%s' unlogging from '%s'.\n",
  55. - usr, ut.ut_id);
  56. -
  57. - pututxline(&ut);
  58. + usr, term);
  59. + logout(term);
  60. +
  61. break;
  62. default:
  63. plog(LLV_ERROR, LOCATION, NULL, "Unepected inout\n");