Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Achou.Wang
accel-ppp
提交
a35ddd5d
A
accel-ppp
项目概览
Achou.Wang
/
accel-ppp
通知
6
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
accel-ppp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a35ddd5d
编写于
7月 09, 2014
作者:
D
Dmitry Kozlov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ppp: auth: answer "Success" to retrasmitted messages if auth layer is already started
上级
1df4a4e7
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
71 addition
and
49 deletion
+71
-49
accel-pppd/auth/auth_chap_md5.c
accel-pppd/auth/auth_chap_md5.c
+24
-18
accel-pppd/auth/auth_mschap_v1.c
accel-pppd/auth/auth_mschap_v1.c
+20
-16
accel-pppd/auth/auth_mschap_v2.c
accel-pppd/auth/auth_mschap_v2.c
+22
-15
accel-pppd/auth/auth_pap.c
accel-pppd/auth/auth_pap.c
+5
-0
未找到文件。
accel-pppd/auth/auth_chap_md5.c
浏览文件 @
a35ddd5d
...
@@ -37,41 +37,36 @@ static int conf_interval = 0;
...
@@ -37,41 +37,36 @@ static int conf_interval = 0;
static
int
conf_max_failure
=
3
;
static
int
conf_max_failure
=
3
;
static
int
conf_any_login
=
0
;
static
int
conf_any_login
=
0
;
struct
chap_hdr_t
struct
chap_hdr_t
{
{
uint16_t
proto
;
uint16_t
proto
;
uint8_t
code
;
uint8_t
code
;
uint8_t
id
;
uint8_t
id
;
uint16_t
len
;
uint16_t
len
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
struct
chap_challenge_t
struct
chap_challenge_t
{
{
struct
chap_hdr_t
hdr
;
struct
chap_hdr_t
hdr
;
uint8_t
val_size
;
uint8_t
val_size
;
uint8_t
val
[
VALUE_SIZE
];
uint8_t
val
[
VALUE_SIZE
];
char
name
[
0
];
char
name
[
0
];
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
struct
chap_failure_t
struct
chap_failure_t
{
{
struct
chap_hdr_t
hdr
;
struct
chap_hdr_t
hdr
;
char
message
[
sizeof
(
MSG_FAILURE
)];
char
message
[
sizeof
(
MSG_FAILURE
)];
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
struct
chap_success_t
struct
chap_success_t
{
{
struct
chap_hdr_t
hdr
;
struct
chap_hdr_t
hdr
;
char
message
[
sizeof
(
MSG_SUCCESS
)];
char
message
[
sizeof
(
MSG_SUCCESS
)];
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
struct
chap_auth_data_t
struct
chap_auth_data_t
{
{
struct
auth_data_t
auth
;
struct
auth_data_t
auth
;
struct
ppp_handler_t
h
;
struct
ppp_handler_t
h
;
struct
ppp_t
*
ppp
;
struct
ppp_t
*
ppp
;
in
t
id
;
uint8_
t
id
;
uint8_t
val
[
VALUE_SIZE
];
uint8_t
val
[
VALUE_SIZE
];
struct
triton_timer_t
timeout
;
struct
triton_timer_t
timeout
;
struct
triton_timer_t
interval
;
struct
triton_timer_t
interval
;
...
@@ -131,6 +126,7 @@ static int chap_start(struct ppp_t *ppp, struct auth_data_t *auth)
...
@@ -131,6 +126,7 @@ static int chap_start(struct ppp_t *ppp, struct auth_data_t *auth)
d
->
timeout
.
period
=
conf_timeout
*
1000
;
d
->
timeout
.
period
=
conf_timeout
*
1000
;
d
->
interval
.
expire
=
chap_restart_timer
;
d
->
interval
.
expire
=
chap_restart_timer
;
d
->
interval
.
period
=
conf_interval
*
1000
;
d
->
interval
.
period
=
conf_interval
*
1000
;
d
->
id
=
1
;
ppp_register_chan_handler
(
ppp
,
&
d
->
h
);
ppp_register_chan_handler
(
ppp
,
&
d
->
h
);
...
@@ -208,12 +204,12 @@ static void chap_send_failure(struct chap_auth_data_t *ad)
...
@@ -208,12 +204,12 @@ static void chap_send_failure(struct chap_auth_data_t *ad)
ppp_chan_send
(
ad
->
ppp
,
&
msg
,
ntohs
(
msg
.
hdr
.
len
)
+
2
);
ppp_chan_send
(
ad
->
ppp
,
&
msg
,
ntohs
(
msg
.
hdr
.
len
)
+
2
);
}
}
static
void
chap_send_success
(
struct
chap_auth_data_t
*
ad
)
static
void
chap_send_success
(
struct
chap_auth_data_t
*
ad
,
int
id
)
{
{
struct
chap_success_t
msg
=
{
struct
chap_success_t
msg
=
{
.
hdr
.
proto
=
htons
(
PPP_CHAP
),
.
hdr
.
proto
=
htons
(
PPP_CHAP
),
.
hdr
.
code
=
CHAP_SUCCESS
,
.
hdr
.
code
=
CHAP_SUCCESS
,
.
hdr
.
id
=
ad
->
id
,
.
hdr
.
id
=
id
,
.
hdr
.
len
=
htons
(
sizeof
(
msg
)
-
1
-
2
),
.
hdr
.
len
=
htons
(
sizeof
(
msg
)
-
1
-
2
),
.
message
=
MSG_SUCCESS
,
.
message
=
MSG_SUCCESS
,
};
};
...
@@ -229,7 +225,7 @@ static void chap_send_challenge(struct chap_auth_data_t *ad, int new)
...
@@ -229,7 +225,7 @@ static void chap_send_challenge(struct chap_auth_data_t *ad, int new)
struct
chap_challenge_t
msg
=
{
struct
chap_challenge_t
msg
=
{
.
hdr
.
proto
=
htons
(
PPP_CHAP
),
.
hdr
.
proto
=
htons
(
PPP_CHAP
),
.
hdr
.
code
=
CHAP_CHALLENGE
,
.
hdr
.
code
=
CHAP_CHALLENGE
,
.
hdr
.
id
=
++
ad
->
id
,
.
hdr
.
id
=
ad
->
id
,
.
hdr
.
len
=
htons
(
sizeof
(
msg
)
-
2
),
.
hdr
.
len
=
htons
(
sizeof
(
msg
)
-
2
),
.
val_size
=
VALUE_SIZE
,
.
val_size
=
VALUE_SIZE
,
};
};
...
@@ -271,6 +267,11 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
...
@@ -271,6 +267,11 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
log_ppp_info2
(
"
\"
]
\n
"
);
log_ppp_info2
(
"
\"
]
\n
"
);
}
}
if
(
ad
->
started
&&
msg
->
hdr
.
id
==
ad
->
id
-
1
)
{
chap_send_success
(
ad
,
msg
->
hdr
.
id
);
return
;
}
if
(
msg
->
hdr
.
id
!=
ad
->
id
)
{
if
(
msg
->
hdr
.
id
!=
ad
->
id
)
{
if
(
conf_ppp_verbose
)
if
(
conf_ppp_verbose
)
log_ppp_warn
(
"chap-md5: id mismatch
\n
"
);
log_ppp_warn
(
"chap-md5: id mismatch
\n
"
);
...
@@ -296,8 +297,9 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
...
@@ -296,8 +297,9 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
_free
(
name
);
_free
(
name
);
return
;
return
;
}
}
chap_send_success
(
ad
);
chap_send_success
(
ad
,
ad
->
id
);
ad
->
started
=
1
;
ad
->
started
=
1
;
ad
->
id
++
;
return
;
return
;
}
}
...
@@ -337,13 +339,15 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
...
@@ -337,13 +339,15 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
ap_session_terminate
(
&
ad
->
ppp
->
ses
,
TERM_AUTH_ERROR
,
0
);
ap_session_terminate
(
&
ad
->
ppp
->
ses
,
TERM_AUTH_ERROR
,
0
);
_free
(
name
);
_free
(
name
);
}
else
{
}
else
{
chap_send_success
(
ad
);
chap_send_success
(
ad
,
ad
->
id
);
ad
->
started
=
1
;
ad
->
started
=
1
;
if
(
conf_interval
)
if
(
conf_interval
)
triton_timer_add
(
ad
->
ppp
->
ses
.
ctrl
->
ctx
,
&
ad
->
interval
,
0
);
triton_timer_add
(
ad
->
ppp
->
ses
.
ctrl
->
ctx
,
&
ad
->
interval
,
0
);
}
}
}
else
}
else
_free
(
name
);
_free
(
name
);
ad
->
id
++
;
}
}
_free
(
passwd
);
_free
(
passwd
);
}
else
if
(
r
==
PWDB_DENIED
)
{
}
else
if
(
r
==
PWDB_DENIED
)
{
...
@@ -360,15 +364,17 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
...
@@ -360,15 +364,17 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
ap_session_terminate
(
&
ad
->
ppp
->
ses
,
TERM_AUTH_ERROR
,
0
);
ap_session_terminate
(
&
ad
->
ppp
->
ses
,
TERM_AUTH_ERROR
,
0
);
_free
(
name
);
_free
(
name
);
}
else
{
}
else
{
chap_send_success
(
ad
);
chap_send_success
(
ad
,
ad
->
id
);
ad
->
started
=
1
;
ad
->
started
=
1
;
if
(
conf_interval
)
if
(
conf_interval
)
triton_timer_add
(
ad
->
ppp
->
ses
.
ctrl
->
ctx
,
&
ad
->
interval
,
0
);
triton_timer_add
(
ad
->
ppp
->
ses
.
ctrl
->
ctx
,
&
ad
->
interval
,
0
);
}
}
}
else
{
}
else
{
chap_send_success
(
ad
);
chap_send_success
(
ad
,
ad
->
id
);
_free
(
name
);
_free
(
name
);
}
}
ad
->
id
++
;
}
}
}
}
...
...
accel-pppd/auth/auth_mschap_v1.c
浏览文件 @
a35ddd5d
...
@@ -37,26 +37,22 @@ static int conf_max_failure = 3;
...
@@ -37,26 +37,22 @@ static int conf_max_failure = 3;
static
int
conf_any_login
=
0
;
static
int
conf_any_login
=
0
;
static
char
*
conf_msg_failure
=
"E=691 R=0"
;
static
char
*
conf_msg_failure
=
"E=691 R=0"
;
static
char
*
conf_msg_success
=
"Authentication succeeded"
;
static
char
*
conf_msg_success
=
"Authentication succeeded"
;
;
struct
chap_hdr_t
struct
chap_hdr_t
{
{
uint16_t
proto
;
uint16_t
proto
;
uint8_t
code
;
uint8_t
code
;
uint8_t
id
;
uint8_t
id
;
uint16_t
len
;
uint16_t
len
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
struct
chap_challenge_t
struct
chap_challenge_t
{
{
struct
chap_hdr_t
hdr
;
struct
chap_hdr_t
hdr
;
uint8_t
val_size
;
uint8_t
val_size
;
uint8_t
val
[
VALUE_SIZE
];
uint8_t
val
[
VALUE_SIZE
];
char
name
[
0
];
char
name
[
0
];
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
struct
chap_response_t
struct
chap_response_t
{
{
struct
chap_hdr_t
hdr
;
struct
chap_hdr_t
hdr
;
uint8_t
val_size
;
uint8_t
val_size
;
uint8_t
lm_hash
[
24
];
uint8_t
lm_hash
[
24
];
...
@@ -65,12 +61,11 @@ struct chap_response_t
...
@@ -65,12 +61,11 @@ struct chap_response_t
char
name
[
0
];
char
name
[
0
];
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
struct
chap_auth_data_t
struct
chap_auth_data_t
{
{
struct
auth_data_t
auth
;
struct
auth_data_t
auth
;
struct
ppp_handler_t
h
;
struct
ppp_handler_t
h
;
struct
ppp_t
*
ppp
;
struct
ppp_t
*
ppp
;
in
t
id
;
uint8_
t
id
;
uint8_t
val
[
VALUE_SIZE
];
uint8_t
val
[
VALUE_SIZE
];
struct
triton_timer_t
timeout
;
struct
triton_timer_t
timeout
;
struct
triton_timer_t
interval
;
struct
triton_timer_t
interval
;
...
@@ -132,6 +127,7 @@ static int chap_start(struct ppp_t *ppp, struct auth_data_t *auth)
...
@@ -132,6 +127,7 @@ static int chap_start(struct ppp_t *ppp, struct auth_data_t *auth)
d
->
timeout
.
period
=
conf_timeout
*
1000
;
d
->
timeout
.
period
=
conf_timeout
*
1000
;
d
->
interval
.
expire
=
chap_restart_timer
;
d
->
interval
.
expire
=
chap_restart_timer
;
d
->
interval
.
period
=
conf_interval
*
1000
;
d
->
interval
.
period
=
conf_interval
*
1000
;
d
->
id
=
1
;
ppp_register_chan_handler
(
ppp
,
&
d
->
h
);
ppp_register_chan_handler
(
ppp
,
&
d
->
h
);
...
@@ -210,12 +206,12 @@ static void chap_send_failure(struct chap_auth_data_t *ad, char *mschap_error)
...
@@ -210,12 +206,12 @@ static void chap_send_failure(struct chap_auth_data_t *ad, char *mschap_error)
_free
(
hdr
);
_free
(
hdr
);
}
}
static
void
chap_send_success
(
struct
chap_auth_data_t
*
ad
)
static
void
chap_send_success
(
struct
chap_auth_data_t
*
ad
,
int
id
)
{
{
struct
chap_hdr_t
*
hdr
=
_malloc
(
sizeof
(
*
hdr
)
+
strlen
(
conf_msg_success
)
+
1
);
struct
chap_hdr_t
*
hdr
=
_malloc
(
sizeof
(
*
hdr
)
+
strlen
(
conf_msg_success
)
+
1
);
hdr
->
proto
=
htons
(
PPP_CHAP
);
hdr
->
proto
=
htons
(
PPP_CHAP
);
hdr
->
code
=
CHAP_SUCCESS
;
hdr
->
code
=
CHAP_SUCCESS
;
hdr
->
id
=
ad
->
id
;
hdr
->
id
=
id
;
hdr
->
len
=
htons
(
HDR_LEN
+
strlen
(
conf_msg_success
));
hdr
->
len
=
htons
(
HDR_LEN
+
strlen
(
conf_msg_success
));
strcpy
((
char
*
)(
hdr
+
1
),
conf_msg_success
);
strcpy
((
char
*
)(
hdr
+
1
),
conf_msg_success
);
...
@@ -232,7 +228,7 @@ static void chap_send_challenge(struct chap_auth_data_t *ad, int new)
...
@@ -232,7 +228,7 @@ static void chap_send_challenge(struct chap_auth_data_t *ad, int new)
struct
chap_challenge_t
msg
=
{
struct
chap_challenge_t
msg
=
{
.
hdr
.
proto
=
htons
(
PPP_CHAP
),
.
hdr
.
proto
=
htons
(
PPP_CHAP
),
.
hdr
.
code
=
CHAP_CHALLENGE
,
.
hdr
.
code
=
CHAP_CHALLENGE
,
.
hdr
.
id
=
++
ad
->
id
,
.
hdr
.
id
=
ad
->
id
,
.
hdr
.
len
=
htons
(
sizeof
(
msg
)
-
2
),
.
hdr
.
len
=
htons
(
sizeof
(
msg
)
-
2
),
.
val_size
=
VALUE_SIZE
,
.
val_size
=
VALUE_SIZE
,
};
};
...
@@ -274,6 +270,11 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
...
@@ -274,6 +270,11 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
log_ppp_info2
(
"
\"
]
\n
"
);
log_ppp_info2
(
"
\"
]
\n
"
);
}
}
if
(
ad
->
started
&&
msg
->
hdr
.
id
==
ad
->
id
-
1
)
{
chap_send_success
(
ad
,
msg
->
hdr
.
id
);
return
;
}
if
(
msg
->
hdr
.
id
!=
ad
->
id
)
{
if
(
msg
->
hdr
.
id
!=
ad
->
id
)
{
if
(
conf_ppp_verbose
)
if
(
conf_ppp_verbose
)
log_ppp_warn
(
"mschap-v1: id mismatch
\n
"
);
log_ppp_warn
(
"mschap-v1: id mismatch
\n
"
);
...
@@ -306,8 +307,9 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
...
@@ -306,8 +307,9 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
_free
(
name
);
_free
(
name
);
return
;
return
;
}
}
chap_send_success
(
ad
);
chap_send_success
(
ad
,
ad
->
id
);
ad
->
started
=
1
;
ad
->
started
=
1
;
ad
->
id
++
;
return
;
return
;
}
}
...
@@ -332,15 +334,17 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
...
@@ -332,15 +334,17 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
ap_session_terminate
(
&
ad
->
ppp
->
ses
,
TERM_AUTH_ERROR
,
0
);
ap_session_terminate
(
&
ad
->
ppp
->
ses
,
TERM_AUTH_ERROR
,
0
);
_free
(
name
);
_free
(
name
);
}
else
{
}
else
{
chap_send_success
(
ad
);
chap_send_success
(
ad
,
ad
->
id
);
ad
->
started
=
1
;
ad
->
started
=
1
;
if
(
conf_interval
)
if
(
conf_interval
)
triton_timer_add
(
ad
->
ppp
->
ses
.
ctrl
->
ctx
,
&
ad
->
interval
,
0
);
triton_timer_add
(
ad
->
ppp
->
ses
.
ctrl
->
ctx
,
&
ad
->
interval
,
0
);
}
}
}
else
{
}
else
{
chap_send_success
(
ad
);
chap_send_success
(
ad
,
ad
->
id
);
_free
(
name
);
_free
(
name
);
}
}
ad
->
id
++
;
}
}
}
}
...
...
accel-pppd/auth/auth_mschap_v2.c
浏览文件 @
a35ddd5d
...
@@ -38,24 +38,21 @@ static char *conf_msg_failure = "E=691 R=0 V=3";
...
@@ -38,24 +38,21 @@ static char *conf_msg_failure = "E=691 R=0 V=3";
static
char
*
conf_msg_failure2
=
"Authentication failure"
;
static
char
*
conf_msg_failure2
=
"Authentication failure"
;
static
char
*
conf_msg_success
=
"Authentication succeeded"
;
static
char
*
conf_msg_success
=
"Authentication succeeded"
;
struct
chap_hdr_t
struct
chap_hdr_t
{
{
uint16_t
proto
;
uint16_t
proto
;
uint8_t
code
;
uint8_t
code
;
uint8_t
id
;
uint8_t
id
;
uint16_t
len
;
uint16_t
len
;
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
struct
chap_challenge_t
struct
chap_challenge_t
{
{
struct
chap_hdr_t
hdr
;
struct
chap_hdr_t
hdr
;
uint8_t
val_size
;
uint8_t
val_size
;
uint8_t
val
[
VALUE_SIZE
];
uint8_t
val
[
VALUE_SIZE
];
char
name
[
0
];
char
name
[
0
];
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
struct
chap_response_t
struct
chap_response_t
{
{
struct
chap_hdr_t
hdr
;
struct
chap_hdr_t
hdr
;
uint8_t
val_size
;
uint8_t
val_size
;
uint8_t
peer_challenge
[
16
];
uint8_t
peer_challenge
[
16
];
...
@@ -65,15 +62,15 @@ struct chap_response_t
...
@@ -65,15 +62,15 @@ struct chap_response_t
char
name
[
0
];
char
name
[
0
];
}
__attribute__
((
packed
));
}
__attribute__
((
packed
));
struct
chap_auth_data_t
struct
chap_auth_data_t
{
{
struct
auth_data_t
auth
;
struct
auth_data_t
auth
;
struct
ppp_handler_t
h
;
struct
ppp_handler_t
h
;
struct
ppp_t
*
ppp
;
struct
ppp_t
*
ppp
;
in
t
id
;
uint8_
t
id
;
uint8_t
val
[
VALUE_SIZE
];
uint8_t
val
[
VALUE_SIZE
];
struct
triton_timer_t
timeout
;
struct
triton_timer_t
timeout
;
struct
triton_timer_t
interval
;
struct
triton_timer_t
interval
;
char
authenticator
[
41
];
int
failure
;
int
failure
;
int
started
:
1
;
int
started
:
1
;
};
};
...
@@ -133,6 +130,7 @@ static int chap_start(struct ppp_t *ppp, struct auth_data_t *auth)
...
@@ -133,6 +130,7 @@ static int chap_start(struct ppp_t *ppp, struct auth_data_t *auth)
d
->
timeout
.
period
=
conf_timeout
*
1000
;
d
->
timeout
.
period
=
conf_timeout
*
1000
;
d
->
interval
.
expire
=
chap_restart_timer
;
d
->
interval
.
expire
=
chap_restart_timer
;
d
->
interval
.
period
=
conf_interval
*
1000
;
d
->
interval
.
period
=
conf_interval
*
1000
;
d
->
id
=
1
;
ppp_register_chan_handler
(
ppp
,
&
d
->
h
);
ppp_register_chan_handler
(
ppp
,
&
d
->
h
);
...
@@ -212,12 +210,12 @@ static void chap_send_failure(struct chap_auth_data_t *ad, char *mschap_error, c
...
@@ -212,12 +210,12 @@ static void chap_send_failure(struct chap_auth_data_t *ad, char *mschap_error, c
_free
(
hdr
);
_free
(
hdr
);
}
}
static
void
chap_send_success
(
struct
chap_auth_data_t
*
ad
,
struct
chap_response_t
*
res_msg
,
const
char
*
authenticator
)
static
void
chap_send_success
(
struct
chap_auth_data_t
*
ad
,
int
id
,
const
char
*
authenticator
)
{
{
struct
chap_hdr_t
*
hdr
=
_malloc
(
sizeof
(
*
hdr
)
+
strlen
(
conf_msg_success
)
+
1
+
45
);
struct
chap_hdr_t
*
hdr
=
_malloc
(
sizeof
(
*
hdr
)
+
strlen
(
conf_msg_success
)
+
1
+
45
);
hdr
->
proto
=
htons
(
PPP_CHAP
),
hdr
->
proto
=
htons
(
PPP_CHAP
),
hdr
->
code
=
CHAP_SUCCESS
,
hdr
->
code
=
CHAP_SUCCESS
,
hdr
->
id
=
ad
->
id
,
hdr
->
id
=
id
,
hdr
->
len
=
htons
(
HDR_LEN
+
strlen
(
conf_msg_success
)
+
45
),
hdr
->
len
=
htons
(
HDR_LEN
+
strlen
(
conf_msg_success
)
+
45
),
sprintf
((
char
*
)(
hdr
+
1
),
"S=%s M=%s"
,
authenticator
,
conf_msg_success
);
sprintf
((
char
*
)(
hdr
+
1
),
"S=%s M=%s"
,
authenticator
,
conf_msg_success
);
...
@@ -305,7 +303,7 @@ static void chap_send_challenge(struct chap_auth_data_t *ad, int new)
...
@@ -305,7 +303,7 @@ static void chap_send_challenge(struct chap_auth_data_t *ad, int new)
struct
chap_challenge_t
msg
=
{
struct
chap_challenge_t
msg
=
{
.
hdr
.
proto
=
htons
(
PPP_CHAP
),
.
hdr
.
proto
=
htons
(
PPP_CHAP
),
.
hdr
.
code
=
CHAP_CHALLENGE
,
.
hdr
.
code
=
CHAP_CHALLENGE
,
.
hdr
.
id
=
++
ad
->
id
,
.
hdr
.
id
=
ad
->
id
,
.
hdr
.
len
=
htons
(
sizeof
(
msg
)
-
2
),
.
hdr
.
len
=
htons
(
sizeof
(
msg
)
-
2
),
.
val_size
=
VALUE_SIZE
,
.
val_size
=
VALUE_SIZE
,
};
};
...
@@ -351,6 +349,11 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
...
@@ -351,6 +349,11 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
log_ppp_info2
(
"
\"
]
\n
"
);
log_ppp_info2
(
"
\"
]
\n
"
);
}
}
if
(
ad
->
started
&&
msg
->
hdr
.
id
==
ad
->
id
-
1
)
{
chap_send_success
(
ad
,
msg
->
hdr
.
id
,
ad
->
authenticator
);
return
;
}
if
(
msg
->
hdr
.
id
!=
ad
->
id
)
{
if
(
msg
->
hdr
.
id
!=
ad
->
id
)
{
if
(
conf_ppp_verbose
)
if
(
conf_ppp_verbose
)
log_ppp_warn
(
"mschap-v2: id mismatch
\n
"
);
log_ppp_warn
(
"mschap-v2: id mismatch
\n
"
);
...
@@ -405,15 +408,19 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
...
@@ -405,15 +408,19 @@ static void chap_recv_response(struct chap_auth_data_t *ad, struct chap_hdr_t *h
ap_session_terminate
(
&
ad
->
ppp
->
ses
,
TERM_AUTH_ERROR
,
0
);
ap_session_terminate
(
&
ad
->
ppp
->
ses
,
TERM_AUTH_ERROR
,
0
);
_free
(
name
);
_free
(
name
);
}
else
{
}
else
{
chap_send_success
(
ad
,
msg
,
authenticator
);
chap_send_success
(
ad
,
ad
->
id
,
authenticator
);
ad
->
started
=
1
;
ad
->
started
=
1
;
if
(
conf_interval
)
if
(
conf_interval
)
triton_timer_add
(
ad
->
ppp
->
ses
.
ctrl
->
ctx
,
&
ad
->
interval
,
0
);
triton_timer_add
(
ad
->
ppp
->
ses
.
ctrl
->
ctx
,
&
ad
->
interval
,
0
);
}
}
}
else
{
}
else
{
chap_send_success
(
ad
,
msg
,
authenticator
);
chap_send_success
(
ad
,
ad
->
id
,
authenticator
);
_free
(
name
);
_free
(
name
);
}
}
memcpy
(
ad
->
authenticator
,
authenticator
,
41
);
ad
->
id
++
;
}
}
}
}
...
...
accel-pppd/auth/auth_pap.c
浏览文件 @
a35ddd5d
...
@@ -183,6 +183,11 @@ static int pap_recv_req(struct pap_auth_data_t *p, struct pap_hdr_t *hdr)
...
@@ -183,6 +183,11 @@ static int pap_recv_req(struct pap_auth_data_t *p, struct pap_hdr_t *hdr)
if
(
conf_ppp_verbose
)
if
(
conf_ppp_verbose
)
log_ppp_info2
(
"recv [PAP AuthReq id=%x]
\n
"
,
hdr
->
id
);
log_ppp_info2
(
"recv [PAP AuthReq id=%x]
\n
"
,
hdr
->
id
);
if
(
p
->
started
)
{
pap_send_ack
(
p
,
hdr
->
id
);
return
0
;
}
peer_id_len
=
*
(
uint8_t
*
)
ptr
;
ptr
++
;
peer_id_len
=
*
(
uint8_t
*
)
ptr
;
ptr
++
;
if
(
peer_id_len
>
ntohs
(
hdr
->
len
)
-
sizeof
(
*
hdr
)
+
2
-
1
)
{
if
(
peer_id_len
>
ntohs
(
hdr
->
len
)
-
sizeof
(
*
hdr
)
+
2
-
1
)
{
log_ppp_warn
(
"PAP: short packet received
\n
"
);
log_ppp_warn
(
"PAP: short packet received
\n
"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录