Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
d99b4bb8
提交
d99b4bb8
authored
5月 01, 2007
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
misc fixes
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@5053
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
578e2cd3
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
670 行增加
和
271 行删除
+670
-271
libdingaling.c
libs/libdingaling/src/libdingaling.c
+11
-12
sha1.c
libs/libdingaling/src/sha1.c
+587
-185
sha1.h
libs/libdingaling/src/sha1.h
+58
-69
mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.c
+9
-5
switch_odbc.c
src/switch_odbc.c
+5
-0
没有找到文件。
libs/libdingaling/src/libdingaling.c
浏览文件 @
d99b4bb8
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
#include <sys/types.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <fcntl.h>
#include <time.h>
#endif
#endif
#include <string.h>
#include <string.h>
...
@@ -82,7 +82,7 @@
...
@@ -82,7 +82,7 @@
static
int
opt_timeout
=
30
;
static
int
opt_timeout
=
30
;
static
void
sha1_hash
(
char
*
out
,
char
*
in
,
unsigned
int
len
);
static
void
sha1_hash
(
char
*
out
,
unsigned
char
*
in
,
unsigned
int
len
);
static
int
b64encode
(
unsigned
char
*
in
,
size_t
ilen
,
unsigned
char
*
out
,
size_t
olen
);
static
int
b64encode
(
unsigned
char
*
in
,
size_t
ilen
,
unsigned
char
*
out
,
size_t
olen
);
static
void
ldl_random_string
(
char
*
buf
,
uint16_t
len
,
char
*
set
);
static
void
ldl_random_string
(
char
*
buf
,
uint16_t
len
,
char
*
set
);
...
@@ -725,7 +725,7 @@ static ldl_avatar_t *ldl_get_avatar(ldl_handle_t *handle, char *path, char *from
...
@@ -725,7 +725,7 @@ static ldl_avatar_t *ldl_get_avatar(ldl_handle_t *handle, char *path, char *from
int
fd
=
-
1
;
int
fd
=
-
1
;
size_t
bytes
;
size_t
bytes
;
char
*
key
;
char
*
key
;
char
hash
[
128
]
=
""
;
//
char hash[128] = "";
if
(
from
&&
(
ap
=
(
ldl_avatar_t
*
)
apr_hash_get
(
globals
.
avatar_hash
,
from
,
APR_HASH_KEY_STRING
)))
{
if
(
from
&&
(
ap
=
(
ldl_avatar_t
*
)
apr_hash_get
(
globals
.
avatar_hash
,
from
,
APR_HASH_KEY_STRING
)))
{
return
ap
;
return
ap
;
...
@@ -756,8 +756,7 @@ static ldl_avatar_t *ldl_get_avatar(ldl_handle_t *handle, char *path, char *from
...
@@ -756,8 +756,7 @@ static ldl_avatar_t *ldl_get_avatar(ldl_handle_t *handle, char *path, char *from
ap
=
malloc
(
sizeof
(
*
ap
));
ap
=
malloc
(
sizeof
(
*
ap
));
assert
(
ap
!=
NULL
);
assert
(
ap
!=
NULL
);
memset
(
ap
,
0
,
sizeof
(
*
ap
));
memset
(
ap
,
0
,
sizeof
(
*
ap
));
ldl_random_string
(
hash
,
sizeof
(
hash
)
-
1
,
NULL
);
sha1_hash
(
ap
->
hash
,
(
unsigned
char
*
)
image
,
(
unsigned
int
)
bytes
);
sha1_hash
(
ap
->
hash
,
hash
,
(
unsigned
)
strlen
(
hash
));
ap
->
path
=
strdup
(
path
);
ap
->
path
=
strdup
(
path
);
key
=
ldl_handle_strdup
(
handle
,
from
);
key
=
ldl_handle_strdup
(
handle
,
from
);
...
@@ -1048,21 +1047,21 @@ static int b64encode(unsigned char *in, size_t ilen, unsigned char *out, size_t
...
@@ -1048,21 +1047,21 @@ static int b64encode(unsigned char *in, size_t ilen, unsigned char *out, size_t
return
0
;
return
0
;
}
}
static
void
sha1_hash
(
char
*
out
,
char
*
in
,
unsigned
int
len
)
static
void
sha1_hash
(
char
*
out
,
unsigned
char
*
in
,
unsigned
int
len
)
{
{
sha_context_
t
sha
;
SHA1Contex
t
sha
;
char
*
p
;
char
*
p
;
int
x
;
int
x
;
unsigned
char
digest
[
20
]
=
""
;
unsigned
char
digest
[
SHA1_HASH_SIZE
]
=
""
;
SHA1Init
(
&
sha
);
SHA1Init
(
&
sha
);
SHA1Update
(
&
sha
,
(
unsigned
char
*
)
in
,
len
);
SHA1Update
(
&
sha
,
in
,
len
);
SHA1Final
(
digest
,
&
sha
);
SHA1Final
(
&
sha
,
digest
);
p
=
out
;
p
=
out
;
for
(
x
=
0
;
x
<
20
;
x
++
)
{
for
(
x
=
0
;
x
<
SHA1_HASH_SIZE
;
x
++
)
{
p
+=
sprintf
(
p
,
"%2.2x"
,
digest
[
x
]);
p
+=
sprintf
(
p
,
"%2.2x"
,
digest
[
x
]);
}
}
}
}
...
@@ -1084,7 +1083,7 @@ static int on_stream_component(ldl_handle_t *handle, int type, iks *node)
...
@@ -1084,7 +1083,7 @@ static int on_stream_component(ldl_handle_t *handle, int type, iks *node)
char
handshake
[
512
]
=
""
;
char
handshake
[
512
]
=
""
;
snprintf
(
secret
,
sizeof
(
secret
),
"%s%s"
,
pak
->
id
,
handle
->
password
);
snprintf
(
secret
,
sizeof
(
secret
),
"%s%s"
,
pak
->
id
,
handle
->
password
);
sha1_hash
(
hash
,
secret
,
(
unsigned
)
strlen
(
secret
));
sha1_hash
(
hash
,
(
unsigned
char
*
)
secret
,
(
unsigned
int
)
strlen
(
secret
));
snprintf
(
handshake
,
sizeof
(
handshake
),
"<handshake>%s</handshake>"
,
hash
);
snprintf
(
handshake
,
sizeof
(
handshake
),
"<handshake>%s</handshake>"
,
hash
);
iks_send_raw
(
handle
->
parser
,
handshake
);
iks_send_raw
(
handle
->
parser
,
handshake
);
handle
->
state
=
CS_START
;
handle
->
state
=
CS_START
;
...
...
libs/libdingaling/src/sha1.c
浏览文件 @
d99b4bb8
差异被折叠。
点击展开。
libs/libdingaling/src/sha1.h
浏览文件 @
d99b4bb8
/*
/*
-
*
libDingaLing XMPP Jingle Library
*
Copyright (c) 2001-2003 Allan Saddi <allan@saddi.com>
*
Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
*
All rights reserved.
*
*
* Version: MPL 1.1
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
*
* The contents of this file are subject to the Mozilla Public License Version
* THIS SOFTWARE IS PROVIDED BY ALLAN SADDI AND HIS CONTRIBUTORS ``AS IS''
* 1.1 (the "License"); you may not use this file except in compliance with
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* the License. You may obtain a copy of the License at
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* http://www.mozilla.org/MPL/
* ARE DISCLAIMED. IN NO EVENT SHALL ALLAN SADDI OR HIS CONTRIBUTORS BE
*
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* Software distributed under the License is distributed on an "AS IS" basis,
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* for the specific language governing rights and limitations under the
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* License.
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
*
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* The Original Code is libDingaLing XMPP Jingle Library
* POSSIBILITY OF SUCH DAMAGE.
*
* The Initial Developer of the Original Code is
* Steve Reid <steve@edmweb.com>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Steve Reid <steve@edmweb.com>
*
* sha1.h
*
*
* $Id: sha1.h 347 2003-02-23 22:11:49Z asaddi $
*/
*/
/*! \file sha1.h
\brief SHA1
*/
#ifndef __SHA1_H
#define __SHA1_H
#ifdef __cplusplus
extern
"C"
{
#endif
#ifdef __STUPIDFORMATBUG__
}
#endif
#
undef inline
#
ifndef _SHA1_H
#define
inline __inline
#define
_SHA1_H
#ifndef uint32_t
#if HAVE_INTTYPES_H
#ifdef WIN32
# include <inttypes.h>
typedef
unsigned
__int8
uint8_t
;
typedef
unsigned
__int16
uint16_t
;
typedef
unsigned
__int32
uint32_t
;
typedef
unsigned
__int64
uint64_t
;
typedef
__int8
int8_t
;
typedef
__int16
int16_t
;
typedef
__int32
int32_t
;
typedef
__int64
int64_t
;
typedef
unsigned
long
in_addr_t
;
#else
#else
#include <limits.h>
# if HAVE_STDINT_H
#include <inttypes.h>
# include <stdint.h>
#include <sys/types.h>
# endif
#include <inttypes.h>
#include <unistd.h>
#include <stdlib.h>
#include <time.h>
#endif
#endif
#endif
typedef
struct
{
#define SHA1_HASH_SIZE 20
uint32_t
state
[
5
];
uint32_t
count
[
2
];
/* Hash size in 32-bit words */
unsigned
char
buffer
[
64
];
#define SHA1_HASH_WORDS 5
}
sha_context_t
;
struct
_SHA1Context
{
uint64_t
totalLength
;
uint32_t
hash
[
SHA1_HASH_WORDS
];
uint32_t
bufferLength
;
union
{
uint32_t
words
[
16
];
uint8_t
bytes
[
64
];
}
buffer
;
#ifdef RUNTIME_ENDIAN
int
littleEndian
;
#endif
/* RUNTIME_ENDIAN */
};
void
SHA1Transform
(
uint32_t
state
[
5
],
unsigned
char
buffer
[
64
]);
typedef
struct
_SHA1Context
SHA1Context
;
void
SHA1Init
(
sha_context_t
*
context
);
void
SHA1Update
(
sha_context_t
*
context
,
unsigned
char
*
data
,
uint32_t
len
);
void
SHA1Final
(
unsigned
char
digest
[
20
],
sha_context_t
*
context
);
#ifdef __cplusplus
#ifdef __cplusplus
}
extern
"C"
{
#endif
#endif
void
SHA1Init
(
SHA1Context
*
sc
);
void
SHA1Update
(
SHA1Context
*
sc
,
const
void
*
data
,
uint32_t
len
);
void
SHA1Final
(
SHA1Context
*
sc
,
uint8_t
hash
[
SHA1_HASH_SIZE
]);
#ifdef __cplusplus
}
#endif
#endif
#endif
/* _SHA1_H */
src/mod/endpoints/mod_sofia/mod_sofia.c
浏览文件 @
d99b4bb8
...
@@ -1420,15 +1420,11 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
...
@@ -1420,15 +1420,11 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
switch_find_local_ip
(
mod_sofia_globals
.
guess_ip
,
sizeof
(
mod_sofia_globals
.
guess_ip
),
AF_INET
);
switch_find_local_ip
(
mod_sofia_globals
.
guess_ip
,
sizeof
(
mod_sofia_globals
.
guess_ip
),
AF_INET
);
if
(
switch_event_bind
((
char
*
)
modname
,
SWITCH_EVENT_CUSTOM
,
MULTICAST_EVENT
,
event_handler
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Couldn't bind!
\n
"
);
return
SWITCH_STATUS_TERM
;
}
switch_core_hash_init
(
&
mod_sofia_globals
.
profile_hash
,
module_pool
);
switch_core_hash_init
(
&
mod_sofia_globals
.
profile_hash
,
module_pool
);
switch_core_hash_init
(
&
mod_sofia_globals
.
gateway_hash
,
module_pool
);
switch_core_hash_init
(
&
mod_sofia_globals
.
gateway_hash
,
module_pool
);
switch_mutex_init
(
&
mod_sofia_globals
.
hash_mutex
,
SWITCH_MUTEX_NESTED
,
module_pool
);
switch_mutex_init
(
&
mod_sofia_globals
.
hash_mutex
,
SWITCH_MUTEX_NESTED
,
module_pool
);
if
(
config_sofia
(
0
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
if
(
config_sofia
(
0
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
return
SWITCH_STATUS_GENERR
;
return
SWITCH_STATUS_GENERR
;
}
}
...
@@ -1437,6 +1433,14 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
...
@@ -1437,6 +1433,14 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_mod
mod_sofia_globals
.
running
=
1
;
mod_sofia_globals
.
running
=
1
;
switch_mutex_unlock
(
mod_sofia_globals
.
mutex
);
switch_mutex_unlock
(
mod_sofia_globals
.
mutex
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Waiting for profiles to start
\n
"
);
switch_yield
(
1500000
);
if
(
switch_event_bind
((
char
*
)
modname
,
SWITCH_EVENT_CUSTOM
,
MULTICAST_EVENT
,
event_handler
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Couldn't bind!
\n
"
);
return
SWITCH_STATUS_TERM
;
}
if
(
switch_event_bind
((
char
*
)
modname
,
SWITCH_EVENT_PRESENCE_IN
,
SWITCH_EVENT_SUBCLASS_ANY
,
sofia_presence_event_handler
,
NULL
)
if
(
switch_event_bind
((
char
*
)
modname
,
SWITCH_EVENT_PRESENCE_IN
,
SWITCH_EVENT_SUBCLASS_ANY
,
sofia_presence_event_handler
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
!=
SWITCH_STATUS_SUCCESS
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Couldn't bind!
\n
"
);
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"Couldn't bind!
\n
"
);
...
...
src/switch_odbc.c
浏览文件 @
d99b4bb8
...
@@ -176,6 +176,11 @@ static int db_is_up(switch_odbc_handle_t *handle)
...
@@ -176,6 +176,11 @@ static int db_is_up(switch_odbc_handle_t *handle)
char
*
err_str
=
NULL
;
char
*
err_str
=
NULL
;
SQLCHAR
sql
[]
=
"select 1"
;
SQLCHAR
sql
[]
=
"select 1"
;
if
(
!
handle
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_CRIT
,
"No DB Handle
\n
"
);
goto
done
;
}
if
(
SQLAllocHandle
(
SQL_HANDLE_STMT
,
handle
->
con
,
&
stmt
)
!=
SQL_SUCCESS
)
{
if
(
SQLAllocHandle
(
SQL_HANDLE_STMT
,
handle
->
con
,
&
stmt
)
!=
SQL_SUCCESS
)
{
goto
error
;
goto
error
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论