Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
e31c74b6
提交
e31c74b6
authored
1月 25, 2013
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use cert dir from tls config to find wss certs
上级
2cb45cc1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
37 行增加
和
3 行删除
+37
-3
tport_type_ws.c
libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c
+37
-3
没有找到文件。
libs/sofia-sip/libsofia-sip-ua/tport/tport_type_ws.c
浏览文件 @
e31c74b6
...
@@ -347,6 +347,36 @@ static int tport_ws_init_primary_secure(tport_primary_t *pri,
...
@@ -347,6 +347,36 @@ static int tport_ws_init_primary_secure(tport_primary_t *pri,
tport_ws_primary_t
*
wspri
=
(
tport_ws_primary_t
*
)
pri
;
tport_ws_primary_t
*
wspri
=
(
tport_ws_primary_t
*
)
pri
;
const
char
*
cert
=
"/ssl.pem"
;
const
char
*
cert
=
"/ssl.pem"
;
const
char
*
key
=
"/ssl.pem"
;
const
char
*
key
=
"/ssl.pem"
;
char
*
homedir
;
char
*
tbf
=
NULL
;
su_home_t
autohome
[
SU_HOME_AUTO_SIZE
(
1024
)];
char
const
*
path
=
NULL
;
int
ret
=
-
1
;
su_home_auto
(
autohome
,
sizeof
autohome
);
tl_gets
(
tags
,
TPTAG_CERTIFICATE_REF
(
path
),
TAG_END
());
if
(
!
path
)
{
homedir
=
getenv
(
"HOME"
);
if
(
!
homedir
)
homedir
=
""
;
path
=
tbf
=
su_sprintf
(
autohome
,
"%s/.sip/auth"
,
homedir
);
}
if
(
path
)
{
key
=
su_sprintf
(
autohome
,
"%s/%s"
,
path
,
"wss.key"
);
if
(
access
(
key
,
R_OK
)
!=
0
)
key
=
NULL
;
cert
=
su_sprintf
(
autohome
,
"%s/%s"
,
path
,
"wss.crt"
);
if
(
access
(
cert
,
R_OK
)
!=
0
)
cert
=
NULL
;
if
(
!
key
)
key
=
su_sprintf
(
autohome
,
"%s/%s"
,
path
,
"wss.pem"
);
if
(
!
cert
)
cert
=
su_sprintf
(
autohome
,
"%s/%s"
,
path
,
"wss.pem"
);
if
(
access
(
key
,
R_OK
)
!=
0
)
key
=
NULL
;
if
(
access
(
cert
,
R_OK
)
!=
0
)
cert
=
NULL
;
}
init_ssl
();
init_ssl
();
// OpenSSL_add_all_algorithms(); /* load & register cryptos */
// OpenSSL_add_all_algorithms(); /* load & register cryptos */
...
@@ -355,7 +385,7 @@ static int tport_ws_init_primary_secure(tport_primary_t *pri,
...
@@ -355,7 +385,7 @@ static int tport_ws_init_primary_secure(tport_primary_t *pri,
wspri
->
ssl_ctx
=
SSL_CTX_new
(
wspri
->
ssl_method
);
/* create context */
wspri
->
ssl_ctx
=
SSL_CTX_new
(
wspri
->
ssl_method
);
/* create context */
wspri
->
ws_secure
=
1
;
wspri
->
ws_secure
=
1
;
if
(
!
wspri
->
ssl_ctx
)
return
-
1
;
if
(
!
wspri
->
ssl_ctx
)
goto
done
;
/* set the local certificate from CertFile */
/* set the local certificate from CertFile */
SSL_CTX_use_certificate_file
(
wspri
->
ssl_ctx
,
cert
,
SSL_FILETYPE_PEM
);
SSL_CTX_use_certificate_file
(
wspri
->
ssl_ctx
,
cert
,
SSL_FILETYPE_PEM
);
...
@@ -363,10 +393,14 @@ static int tport_ws_init_primary_secure(tport_primary_t *pri,
...
@@ -363,10 +393,14 @@ static int tport_ws_init_primary_secure(tport_primary_t *pri,
SSL_CTX_use_PrivateKey_file
(
wspri
->
ssl_ctx
,
key
,
SSL_FILETYPE_PEM
);
SSL_CTX_use_PrivateKey_file
(
wspri
->
ssl_ctx
,
key
,
SSL_FILETYPE_PEM
);
/* verify private key */
/* verify private key */
if
(
!
SSL_CTX_check_private_key
(
wspri
->
ssl_ctx
)
)
{
if
(
!
SSL_CTX_check_private_key
(
wspri
->
ssl_ctx
)
)
{
return
-
1
;
goto
done
;
}
}
return
tport_ws_init_primary
(
pri
,
tpn
,
ai
,
tags
,
return_culprit
);
ret
=
tport_ws_init_primary
(
pri
,
tpn
,
ai
,
tags
,
return_culprit
);
done:
su_home_zap
(
autohome
);
return
ret
;
}
}
int
tport_ws_init_primary
(
tport_primary_t
*
pri
,
int
tport_ws_init_primary
(
tport_primary_t
*
pri
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论