summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2015-02-21 14:55:22 +0300
committerDmitry Kozlov <xeb@mail.ru>2015-02-21 14:55:32 +0300
commitbc767dc4dd80284e836a9c60eb1eed2e6b94b406 (patch)
treec0cacbe73d6e8cbb6c316f6c59ae6cdb62df246c
parent44d9afd7f6f1b066cc1450a89c0bf43df3804d44 (diff)
downloadaccel-ppp-bc767dc4dd80284e836a9c60eb1eed2e6b94b406.tar.gz
accel-ppp-bc767dc4dd80284e836a9c60eb1eed2e6b94b406.zip
ipoe: for option password implemented special value "csid"
If password=csid then password will we same as Calling-Station-Id.
-rw-r--r--accel-pppd/accel-ppp.conf.56
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c13
2 files changed, 16 insertions, 3 deletions
diff --git a/accel-pppd/accel-ppp.conf.5 b/accel-pppd/accel-ppp.conf.5
index 8bb18862..f87c431b 100644
--- a/accel-pppd/accel-ppp.conf.5
+++ b/accel-pppd/accel-ppp.conf.5
@@ -213,7 +213,7 @@ then lua function with name
.B username
will be called to construct username from dhcp packet fields.
.TP
-.BI "password=" username|empty|<string>
+.BI "password=" username|csid|empty|<string>
Specifies how to generate password.
.br
If password=
@@ -224,6 +224,10 @@ If password=
.B empty
then password will be empty string.
.br
+If password=
+.B csid
+then password will be same as Calling-Station-Id.
+.br
Or you can specify fixed password in
.B <string>.
.TP
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c
index 0764b200..3739475b 100644
--- a/accel-pppd/ctrl/ipoe/ipoe.c
+++ b/accel-pppd/ctrl/ipoe/ipoe.c
@@ -591,6 +591,7 @@ static void ipoe_session_start(struct ipoe_session *ses)
int r;
char *passwd;
char *username;
+ const char *pass;
if (ses->dhcpv4_request && conf_verbose) {
log_ppp_info2("recv ");
@@ -631,15 +632,23 @@ static void ipoe_session_start(struct ipoe_session *ses)
}
#endif
+ if (conf_password) {
+ if (!strcmp(conf_password, "csid"))
+ pass = ses->ctrl.calling_station_id;
+ else
+ pass = conf_password;
+ } else
+ pass = username;
+
ses->username = username;
- r = pwdb_check(&ses->ses, (pwdb_callback)auth_result, ses, username, PPP_PAP, conf_password ? conf_password : username);
+ r = pwdb_check(&ses->ses, (pwdb_callback)auth_result, ses, username, PPP_PAP, pass);
if (r == PWDB_WAIT)
return;
if (r == PWDB_NO_IMPL) {
passwd = pwdb_get_passwd(&ses->ses, username);
- if (!passwd)
+ if (!passwd || strcmp(passwd, pass))
r = PWDB_DENIED;
else {
r = PWDB_SUCCESS;