diff options
author | Kozlov Dmitry <xeb@mail.ru> | 2012-01-18 14:41:48 +0400 |
---|---|---|
committer | Kozlov Dmitry <xeb@mail.ru> | 2012-01-18 14:41:48 +0400 |
commit | 85d6a2b6522d667cbc4ed329afd2d22866efd9b5 (patch) | |
tree | 55e9a02d41f479077454ea610ae90dc0934385ca /accel-pppd/extra | |
parent | bf09c2eed598d00f50ccce86672c7b1d93af5358 (diff) | |
download | accel-ppp-85d6a2b6522d667cbc4ed329afd2d22866efd9b5.tar.gz accel-ppp-85d6a2b6522d667cbc4ed329afd2d22866efd9b5.zip |
implemented logwtmp
Diffstat (limited to 'accel-pppd/extra')
-rw-r--r-- | accel-pppd/extra/CMakeLists.txt | 2 | ||||
-rw-r--r-- | accel-pppd/extra/logwtmp.c | 33 |
2 files changed, 35 insertions, 0 deletions
diff --git a/accel-pppd/extra/CMakeLists.txt b/accel-pppd/extra/CMakeLists.txt index 60fe111..4baf492 100644 --- a/accel-pppd/extra/CMakeLists.txt +++ b/accel-pppd/extra/CMakeLists.txt @@ -3,6 +3,8 @@ ADD_LIBRARY(ippool SHARED ippool.c) ADD_LIBRARY(ipv6pool SHARED ipv6pool.c) ADD_LIBRARY(sigchld SHARED sigchld.c) ADD_LIBRARY(chap-secrets SHARED chap-secrets.c) +ADD_LIBRARY(logwtmp SHARED logwtmp.c) +TARGET_LINK_LIBRARIES(logwtmp util) INSTALL(TARGETS pppd_compat ippool ipv6pool sigchld chap-secrets LIBRARY DESTINATION lib/accel-ppp diff --git a/accel-pppd/extra/logwtmp.c b/accel-pppd/extra/logwtmp.c new file mode 100644 index 0000000..5848102 --- /dev/null +++ b/accel-pppd/extra/logwtmp.c @@ -0,0 +1,33 @@ +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> +#include <string.h> +#include <netinet/in.h> +#include <arpa/inet.h> +#include <utmp.h> + +#include "ppp.h" +#include "events.h" +#include "triton.h" +#include "log.h" + +#include "memdebug.h" + + +static void ev_ppp_started(struct ppp_t *ppp) +{ + logwtmp(ppp->ifname, ppp->username, ppp->ctrl->calling_station_id); +} + +static void ev_ppp_finished(struct ppp_t *ppp) +{ + logwtmp(ppp->ifname, "", ""); +} + +static void init(void) +{ + triton_event_register_handler(EV_PPP_STARTED, (triton_event_func)ev_ppp_started); + triton_event_register_handler(EV_PPP_FINISHED, (triton_event_func)ev_ppp_finished); +} + +DEFINE_INIT(200, init); |