summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--accel-pppd/accel-ppp.conf4
-rw-r--r--accel-pppd/auth/auth_chap_md5.c16
-rw-r--r--accel-pppd/auth/auth_mschap_v1.c16
-rw-r--r--accel-pppd/auth/auth_mschap_v2.c21
-rw-r--r--accel-pppd/auth/auth_pap.c16
5 files changed, 61 insertions, 12 deletions
diff --git a/accel-pppd/accel-ppp.conf b/accel-pppd/accel-ppp.conf
index 34f45132..8ec82124 100644
--- a/accel-pppd/accel-ppp.conf
+++ b/accel-pppd/accel-ppp.conf
@@ -44,6 +44,10 @@ ipv6-accept-peer-intf-id=1
echo-interval=30
echo-failure=3
+[auth]
+#any-login=0
+#noauth=0
+
[pptp]
#echo-interval=30
verbose=1
diff --git a/accel-pppd/auth/auth_chap_md5.c b/accel-pppd/auth/auth_chap_md5.c
index d72f70aa..cc27ba37 100644
--- a/accel-pppd/auth/auth_chap_md5.c
+++ b/accel-pppd/auth/auth_chap_md5.c
@@ -10,6 +10,7 @@
#include "crypto.h"
#include "log.h"
+#include "events.h"
#include "ppp.h"
#include "ppp_auth.h"
#include "ppp_lcp.h"
@@ -414,9 +415,9 @@ static void chap_recv(struct ppp_handler_t *h)
log_ppp_warn("chap-md5: unknown code received %x\n", hdr->code);
}
-static void auth_chap_md5_init()
+static void load_config(void)
{
- char *opt;
+ const char *opt;
opt = conf_get_opt("auth", "timeout");
if (opt && atoi(opt) > 0)
@@ -431,9 +432,12 @@ static void auth_chap_md5_init()
conf_max_failure = atoi(opt);
opt = conf_get_opt("auth", "any-login");
- if (opt && atoi(opt) > 0)
- conf_any_login = 1;
+ if (opt)
+ conf_any_login = atoi(opt);
+}
+static void auth_chap_md5_init()
+{
urandom_fd=open("/dev/urandom", O_RDONLY);
if (urandom_fd < 0) {
@@ -441,8 +445,12 @@ static void auth_chap_md5_init()
return;
}
+ load_config();
+
if (ppp_auth_register_handler(&chap))
log_emerg("chap-md5: failed to register handler\n");
+
+ triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config);
}
DEFINE_INIT(6, auth_chap_md5_init);
diff --git a/accel-pppd/auth/auth_mschap_v1.c b/accel-pppd/auth/auth_mschap_v1.c
index b212f034..2d332524 100644
--- a/accel-pppd/auth/auth_mschap_v1.c
+++ b/accel-pppd/auth/auth_mschap_v1.c
@@ -481,9 +481,9 @@ static void chap_recv(struct ppp_handler_t *h)
log_ppp_warn("mschap-v1: unknown code received %x\n", hdr->code);
}
-static void auth_mschap_v1_init()
+static void load_config(void)
{
- char *opt;
+ const char *opt;
opt = conf_get_opt("auth", "timeout");
if (opt && atoi(opt) > 0)
@@ -498,16 +498,24 @@ static void auth_mschap_v1_init()
conf_max_failure = atoi(opt);
opt = conf_get_opt("auth", "any-login");
- if (opt && atoi(opt) > 0)
- conf_any_login = 1;
+ if (opt)
+ conf_any_login = atoi(opt);
+}
+static void auth_mschap_v1_init()
+{
urandom_fd = open("/dev/urandom", O_RDONLY);
if (urandom_fd < 0) {
log_emerg("mschap-v1: failed to open /dev/urandom: %s\n", strerror(errno));
return;
}
+
+ load_config();
+
if (ppp_auth_register_handler(&chap))
log_emerg("mschap-v1: failed to register handler\n");
+
+ triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config);
}
DEFINE_INIT(5, auth_mschap_v1_init);
diff --git a/accel-pppd/auth/auth_mschap_v2.c b/accel-pppd/auth/auth_mschap_v2.c
index 0dd41430..cb972075 100644
--- a/accel-pppd/auth/auth_mschap_v2.c
+++ b/accel-pppd/auth/auth_mschap_v2.c
@@ -618,6 +618,23 @@ static void chap_recv(struct ppp_handler_t *h)
log_ppp_warn("mschap-v2: unknown code received %x\n",hdr->code);
}
+static void load_config(void)
+{
+ const char *opt;
+
+ opt = conf_get_opt("auth", "timeout");
+ if (opt && atoi(opt) > 0)
+ conf_timeout = atoi(opt);
+
+ opt = conf_get_opt("auth", "interval");
+ if (opt && atoi(opt) > 0)
+ conf_interval = atoi(opt);
+
+ opt = conf_get_opt("auth", "max-failure");
+ if (opt && atoi(opt) > 0)
+ conf_max_failure = atoi(opt);
+}
+
static void auth_mschap_v2_init()
{
urandom_fd = open("/dev/urandom", O_RDONLY);
@@ -626,8 +643,12 @@ static void auth_mschap_v2_init()
return;
}
+ load_config();
+
if (ppp_auth_register_handler(&chap))
log_emerg("mschap-v2: failed to register handler\n");
+
+ triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config);
}
DEFINE_INIT(4, auth_mschap_v2_init);
diff --git a/accel-pppd/auth/auth_pap.c b/accel-pppd/auth/auth_pap.c
index e051dd72..45f9e48d 100644
--- a/accel-pppd/auth/auth_pap.c
+++ b/accel-pppd/auth/auth_pap.c
@@ -4,6 +4,7 @@
#include <arpa/inet.h>
#include "log.h"
+#include "events.h"
#include "ppp.h"
#include "ppp_auth.h"
#include "ppp_lcp.h"
@@ -265,19 +266,26 @@ static void pap_recv(struct ppp_handler_t *h)
}
}
-static void auth_pap_init()
+static void load_config(void)
{
- char *opt;
+ const char *opt;
opt = conf_get_opt("auth", "timeout");
if (opt && atoi(opt) > 0)
conf_timeout = atoi(opt);
opt = conf_get_opt("auth", "any-login");
- if (opt && atoi(opt) > 0)
- conf_any_login = 1;
+ if (opt)
+ conf_any_login = atoi(opt);
+}
+
+static void auth_pap_init()
+{
+ load_config();
ppp_auth_register_handler(&pap);
+
+ triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config);
}
DEFINE_INIT(7, auth_pap_init);