summaryrefslogtreecommitdiff
path: root/accel-pptpd/ppp_auth.c
diff options
context:
space:
mode:
Diffstat (limited to 'accel-pptpd/ppp_auth.c')
-rw-r--r--accel-pptpd/ppp_auth.c72
1 files changed, 62 insertions, 10 deletions
diff --git a/accel-pptpd/ppp_auth.c b/accel-pptpd/ppp_auth.c
index b66727b..1117c21 100644
--- a/accel-pptpd/ppp_auth.c
+++ b/accel-pptpd/ppp_auth.c
@@ -27,12 +27,12 @@ int auth_get_conf_req(struct ppp_layer_t *l, struct lcp_opt32_t *opt)
for(i=0; i<AUTH_MAX; i++)
{
- if (l->auth[i] && l->options.lcp.neg_auth[i]>0)
+ if (l->ppp->auth[i] && l->options.lcp.neg_auth[i]>0)
goto cont;
}
for(i=0; i<AUTH_MAX; i++)
{
- if (l->auth[i] && l->options.lcp.neg_auth[i]==0)
+ if (l->ppp->auth[i] && l->options.lcp.neg_auth[i]==0)
goto cont;
}
return -1;
@@ -40,7 +40,7 @@ int auth_get_conf_req(struct ppp_layer_t *l, struct lcp_opt32_t *opt)
cont:
list_for_each_entry(drv,&drv_list,entry)
{
- if (drv->type==l->auth[i])
+ if (drv->type==l->ppp->auth[i])
break;
}
n=drv->get_conf_req(drv,l,opt);
@@ -56,13 +56,13 @@ int auth_recv_conf_req(struct ppp_layer_t *l, struct lcp_opt_hdr_t *hdr)
for(i=0; i<AUTH_MAX; i++)
{
- if (l->auth[i]==opt->val)
+ if (l->ppp->auth[i]==opt->val)
{
list_for_each_entry(drv,&drv_list,entry)
{
- if (drv->type==l->auth[i])
+ if (drv->type==l->ppp->auth[i])
{
- if (drv->recv_conf_req(drv,l,opt))
+ if (drv->recv_conf_req(drv,l->ppp,opt))
return -1;
l->options.lcp.neg_auth[i]=1;
return 0;
@@ -80,15 +80,15 @@ int auth_recv_conf_rej(struct ppp_layer_t *l, struct lcp_opt_hdr_t *hdr)
for(i=0; i<AUTH_MAX; i++)
{
- if (l->auth[i]==opt->val)
+ if (l->ppp->auth[i]==opt->val)
{
l->options.lcp.neg_auth[i]=-1;
break;
}
}
- for(i=0; i<3; i++)
+ for(i=0; i<AUTH_MAX; i++)
{
- if (l->auth[i] && l->options.lcp.neg_auth[i]!=-1)
+ if (l->ppp->auth[i] && l->options.lcp.neg_auth[i]!=-1)
return 0;
}
return -1;
@@ -100,7 +100,7 @@ int auth_recv_conf_nak(struct ppp_layer_t *l, struct lcp_opt_hdr_t *hdr)
for(i=0; i<AUTH_MAX; i++)
{
- if (l->auth[i]==opt->val)
+ if (l->ppp->auth[i]==opt->val)
{
l->options.lcp.neg_auth[i]=2;
return 0;
@@ -109,3 +109,55 @@ int auth_recv_conf_nak(struct ppp_layer_t *l, struct lcp_opt_hdr_t *hdr)
return -1;
}
+int auth_start(struct ppp_t *ppp)
+{
+ int i;
+ struct auth_driver_t *drv;
+
+ for(i=0; i<AUTH_MAX; i++)
+ {
+ if (ppp->lcp_layer->options.lcp.neg_auth[i]==1)
+ {
+ list_for_each_entry(drv,&drv_list,entry)
+ {
+ if (drv->type==ppp->auth[i])
+ return drv->start(ppp);
+ }
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+void auth_finish(struct ppp_t *ppp)
+{
+ int i;
+ struct auth_driver_t *drv;
+
+ for(i=0; i<AUTH_MAX; i++)
+ {
+ if (ppp->lcp_layer->options.lcp.neg_auth[i]==1)
+ {
+ list_for_each_entry(drv,&drv_list,entry)
+ {
+ if (drv->type==ppp->auth[i])
+ {
+ drv->finish(ppp);
+ return;
+ }
+ }
+ }
+ }
+}
+
+void auth_successed(struct ppp_t *ppp)
+{
+ ppp_layer_started(ppp);
+}
+
+void auth_failed(struct ppp_t *ppp)
+{
+ ppp_terminate(ppp);
+}
+