diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2013-10-02 22:35:17 +0400 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2013-10-02 22:35:17 +0400 |
commit | e461c5423384f21efdd1cfc8d57e2fd39f0d156e (patch) | |
tree | 8fc97d2f44dc9b6ff5e020f9c1d41a8dd5c7ce58 /accel-pppd | |
parent | 6b442343da91747481c07f12584866ef34ed8917 (diff) | |
download | accel-ppp-e461c5423384f21efdd1cfc8d57e2fd39f0d156e.tar.gz accel-ppp-e461c5423384f21efdd1cfc8d57e2fd39f0d156e.zip |
ipoe: intoduced 'password' option to control password generation
Diffstat (limited to 'accel-pppd')
-rw-r--r-- | accel-pppd/accel-ppp.conf | 1 | ||||
-rw-r--r-- | accel-pppd/accel-ppp.conf.5 | 16 | ||||
-rw-r--r-- | accel-pppd/ctrl/ipoe/ipoe.c | 14 |
3 files changed, 29 insertions, 2 deletions
diff --git a/accel-pppd/accel-ppp.conf b/accel-pppd/accel-ppp.conf index 29ece01..38b0fa8 100644 --- a/accel-pppd/accel-ppp.conf +++ b/accel-pppd/accel-ppp.conf @@ -36,6 +36,7 @@ thread-count=4 [ipoe] verbose=1 username=ifname +#password=username lease-time=600 max-lease-time=3600 #unit-cache=1000 diff --git a/accel-pppd/accel-ppp.conf.5 b/accel-pppd/accel-ppp.conf.5 index 6e0d0e0..2d585ba 100644 --- a/accel-pppd/accel-ppp.conf.5 +++ b/accel-pppd/accel-ppp.conf.5 @@ -183,7 +183,7 @@ This should reduce kernel-level interface creation/deletion rate lack. If n is not zero ipoe module will produce verbose logging. .TP .BI "username=" ifname|lua:function -Specifies how to determine username of DHCP user. +Specifies how to determine username of user. .br If username= .B ifname @@ -195,6 +195,20 @@ then lua function with name .B username will be called to construct username from dhcp packet fields. .TP +.BI "password=" username|empty|<string> +Specifies how to generate password. +.br +If password= +.B username +then password will be same as username. +.br +If password= +.B empty +then password will be empty string. +.br +Or you can specify fixed password in +.B <string>. +.TP .BI "lease-time=" n Specifies lease time in seconds to be sent to dhcp client. .TP diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c index ac1a68f..7059e2a 100644 --- a/accel-pppd/ctrl/ipoe/ipoe.c +++ b/accel-pppd/ctrl/ipoe/ipoe.c @@ -101,6 +101,7 @@ static uint32_t conf_src; //static int conf_dhcpv6; static int conf_username; +static const char *conf_password; static int conf_unit_cache; static int conf_noauth; #ifdef RADIUS @@ -474,7 +475,7 @@ static void ipoe_session_start(struct ipoe_session *ses) ap_session_starting(&ses->ses); if (!conf_noauth) { - r = pwdb_check(&ses->ses, ses->ses.username, PPP_PAP, ses->ses.username); + r = pwdb_check(&ses->ses, ses->ses.username, PPP_PAP, conf_password ? conf_password : ses->ses.username); if (r == PWDB_NO_IMPL) { passwd = pwdb_get_passwd(&ses->ses, ses->ses.username); if (!passwd) @@ -2690,6 +2691,17 @@ static void load_config(void) log_emerg("ipoe: unknown username value '%s'\n", opt); } else conf_username = USERNAME_UNSET; + + opt = conf_get_opt("ipoe", "password"); + if (opt) { + if (!strcmp(opt, "username")) + conf_password = NULL; + else if (!strcmp(opt, "empty")) + conf_password = ""; + else + conf_password = opt; + } else + conf_password = NULL; opt = conf_get_opt("ipoe", "netmask"); if (opt) { |