summaryrefslogtreecommitdiff
path: root/accel-pppd/ppp
diff options
context:
space:
mode:
authorKozlov Dmitry <dima@server>2011-04-29 15:31:54 +0400
committerKozlov Dmitry <dima@server>2011-04-29 15:32:40 +0400
commitc5d84b6ea2df1bde706d08065bea656a676cd290 (patch)
tree678031e0dc5d9573036b91f2888f55f80232672c /accel-pppd/ppp
parentea846168bd9ae8ce6eca106b755e890867f5eced (diff)
downloadaccel-ppp-c5d84b6ea2df1bde706d08065bea656a676cd290.tar.gz
accel-ppp-c5d84b6ea2df1bde706d08065bea656a676cd290.zip
ppp,log_file: create per-user log file even if client was not successfuly authorized
Diffstat (limited to 'accel-pppd/ppp')
-rw-r--r--accel-pppd/ppp/ppp_auth.c7
-rw-r--r--accel-pppd/ppp/ppp_auth.h2
2 files changed, 7 insertions, 2 deletions
diff --git a/accel-pppd/ppp/ppp_auth.c b/accel-pppd/ppp/ppp_auth.c
index 92d1f9c9..c67b4e26 100644
--- a/accel-pppd/ppp/ppp_auth.c
+++ b/accel-pppd/ppp/ppp_auth.c
@@ -337,11 +337,16 @@ int __export ppp_auth_successed(struct ppp_t *ppp, char *username)
return 0;
}
-void __export ppp_auth_failed(struct ppp_t *ppp, const char *username)
+void __export ppp_auth_failed(struct ppp_t *ppp, char *username)
{
if (username) {
+ pthread_rwlock_wrlock(&ppp_lock);
+ if (!ppp->username)
+ ppp->username = _strdup(username);
+ pthread_rwlock_unlock(&ppp_lock);
log_ppp_info1("%s: authentication failed\n", username);
log_info1("%s: authentication failed\n", username);
+ triton_event_fire(EV_PPP_AUTH_FAILED, ppp);
} else
log_ppp_info1("authentication failed\n");
ppp_terminate(ppp, TERM_AUTH_ERROR, 0);
diff --git a/accel-pppd/ppp/ppp_auth.h b/accel-pppd/ppp/ppp_auth.h
index c84f5f99..6f86d260 100644
--- a/accel-pppd/ppp/ppp_auth.h
+++ b/accel-pppd/ppp/ppp_auth.h
@@ -30,7 +30,7 @@ struct ppp_auth_handler_t
int ppp_auth_register_handler(struct ppp_auth_handler_t*);
int ppp_auth_successed(struct ppp_t *ppp, char *username);
-void ppp_auth_failed(struct ppp_t *ppp, const char *username);
+void ppp_auth_failed(struct ppp_t *ppp, char *username);
int ppp_auth_restart(struct ppp_t *ppp);
#endif