Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
ee373e7f
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
接近 2 年 前同步成功
通知
12
Star
18
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Openssl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ee373e7f
编写于
2月 22, 2007
作者:
L
Lutz Jänicke
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix problem with multi line responses in -starttls by using a buffering
BIO and BIO_gets().
上级
8d72476e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
8 deletion
+31
-8
apps/s_client.c
apps/s_client.c
+31
-8
未找到文件。
apps/s_client.c
浏览文件 @
ee373e7f
...
...
@@ -912,25 +912,37 @@ re_start:
sbuf_off
=
0
;
/* This is an ugly hack that does a lot of assumptions */
/* We do have to handle multi-line responses which may come
in a single packet or not. We therefore have to use
BIO_gets() which does need a buffering BIO. So during
the initial chitchat we do push a buffering BIO into the
chain that is removed again later on to not disturb the
rest of the s_client operation. */
if
(
starttls_proto
==
PROTO_SMTP
)
{
int
foundit
=
0
;
BIO
*
fbio
=
BIO_new
(
BIO_f_buffer
());
BIO_push
(
fbio
,
sbio
);
/* wait for multi-line response to end from SMTP */
do
{
mbuf_len
=
BIO_
read
(
s
bio
,
mbuf
,
BUFSIZZ
);
mbuf_len
=
BIO_
gets
(
f
bio
,
mbuf
,
BUFSIZZ
);
}
while
(
mbuf_len
>
3
&&
mbuf
[
3
]
==
'-'
);
/* STARTTLS command requires EHLO... */
BIO_printf
(
sbio
,
"EHLO openssl.client.net
\r\n
"
);
BIO_printf
(
fbio
,
"EHLO openssl.client.net
\r\n
"
);
BIO_flush
(
fbio
);
/* wait for multi-line response to end EHLO SMTP response */
do
{
mbuf_len
=
BIO_
read
(
s
bio
,
mbuf
,
BUFSIZZ
);
mbuf_len
=
BIO_
gets
(
f
bio
,
mbuf
,
BUFSIZZ
);
if
(
strstr
(
mbuf
,
"STARTTLS"
))
foundit
=
1
;
}
while
(
mbuf_len
>
3
&&
mbuf
[
3
]
==
'-'
);
BIO_flush
(
fbio
);
BIO_pop
(
fbio
);
BIO_free
(
fbio
);
if
(
!
foundit
)
BIO_printf
(
bio_err
,
"didn't found starttls in server response,"
...
...
@@ -947,17 +959,23 @@ re_start:
else
if
(
starttls_proto
==
PROTO_IMAP
)
{
int
foundit
=
0
;
BIO_read
(
sbio
,
mbuf
,
BUFSIZZ
);
BIO
*
fbio
=
BIO_new
(
BIO_f_buffer
());
BIO_push
(
fbio
,
sbio
);
BIO_gets
(
fbio
,
mbuf
,
BUFSIZZ
);
/* STARTTLS command requires CAPABILITY... */
BIO_printf
(
sbio
,
". CAPABILITY
\r\n
"
);
BIO_printf
(
fbio
,
". CAPABILITY
\r\n
"
);
BIO_flush
(
fbio
);
/* wait for multi-line CAPABILITY response */
do
{
mbuf_len
=
BIO_
read
(
s
bio
,
mbuf
,
BUFSIZZ
);
mbuf_len
=
BIO_
gets
(
f
bio
,
mbuf
,
BUFSIZZ
);
if
(
strstr
(
mbuf
,
"STARTTLS"
))
foundit
=
1
;
}
while
(
mbuf_len
>
3
);
while
(
mbuf_len
>
3
&&
mbuf
[
0
]
!=
'.'
);
BIO_flush
(
fbio
);
BIO_pop
(
fbio
);
BIO_free
(
fbio
);
if
(
!
foundit
)
BIO_printf
(
bio_err
,
"didn't found STARTTLS in server response,"
...
...
@@ -967,12 +985,17 @@ re_start:
}
else
if
(
starttls_proto
==
PROTO_FTP
)
{
BIO
*
fbio
=
BIO_new
(
BIO_f_buffer
());
BIO_push
(
fbio
,
sbio
);
/* wait for multi-line response to end from FTP */
do
{
mbuf_len
=
BIO_
read
(
s
bio
,
mbuf
,
BUFSIZZ
);
mbuf_len
=
BIO_
gets
(
f
bio
,
mbuf
,
BUFSIZZ
);
}
while
(
mbuf_len
>
3
&&
mbuf
[
3
]
==
'-'
);
BIO_flush
(
fbio
);
BIO_pop
(
fbio
);
BIO_free
(
fbio
);
BIO_printf
(
sbio
,
"AUTH TLS
\r\n
"
);
BIO_read
(
sbio
,
sbuf
,
BUFSIZZ
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录