mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-06-07 13:35:00 +00:00
fix issues
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3861 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
968f4fccc3
commit
265268cccd
@ -1016,11 +1016,15 @@ static void sha1_hash(char *out, char *in)
|
|||||||
|
|
||||||
static int on_stream_component(ldl_handle_t *handle, int type, iks *node)
|
static int on_stream_component(ldl_handle_t *handle, int type, iks *node)
|
||||||
{
|
{
|
||||||
ikspak *pak = iks_packet(node);
|
ikspak *pak = NULL;
|
||||||
|
|
||||||
|
if (node) {
|
||||||
|
pak = iks_packet(node);
|
||||||
|
}
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case IKS_NODE_START:
|
case IKS_NODE_START:
|
||||||
if (handle->state == CS_NEW) {
|
if (pak && handle->state == CS_NEW) {
|
||||||
char secret[256] = "";
|
char secret[256] = "";
|
||||||
char hash[256] = "";
|
char hash[256] = "";
|
||||||
char handshake[512] = "";
|
char handshake[512] = "";
|
||||||
@ -1061,8 +1065,6 @@ static int on_stream_component(ldl_handle_t *handle, int type, iks *node)
|
|||||||
return IKS_HOOK;
|
return IKS_HOOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pak = iks_packet(node);
|
|
||||||
iks_filter_packet(handle->filter, pak);
|
iks_filter_packet(handle->filter, pak);
|
||||||
|
|
||||||
if (handle->job_done == 1) {
|
if (handle->job_done == 1) {
|
||||||
@ -1080,6 +1082,7 @@ static int on_stream(ldl_handle_t *handle, int type, iks *node)
|
|||||||
{
|
{
|
||||||
handle->counter = opt_timeout;
|
handle->counter = opt_timeout;
|
||||||
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case IKS_NODE_START:
|
case IKS_NODE_START:
|
||||||
if (ldl_test_flag(handle, LDL_FLAG_TLS) && !iks_is_secure(handle->parser)) {
|
if (ldl_test_flag(handle, LDL_FLAG_TLS) && !iks_is_secure(handle->parser)) {
|
||||||
@ -1091,9 +1094,7 @@ static int on_stream(ldl_handle_t *handle, int type, iks *node)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IKS_NODE_NORMAL:
|
case IKS_NODE_NORMAL:
|
||||||
|
if (node && strcmp("stream:features", iks_name(node)) == 0) {
|
||||||
|
|
||||||
if (strcmp("stream:features", iks_name(node)) == 0) {
|
|
||||||
handle->features = iks_stream_features(node);
|
handle->features = iks_stream_features(node);
|
||||||
if (ldl_test_flag(handle, LDL_FLAG_TLS) && !iks_is_secure(handle->parser))
|
if (ldl_test_flag(handle, LDL_FLAG_TLS) && !iks_is_secure(handle->parser))
|
||||||
break;
|
break;
|
||||||
@ -1137,12 +1138,12 @@ static int on_stream(ldl_handle_t *handle, int type, iks *node)
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (strcmp("failure", iks_name(node)) == 0) {
|
} else if (node && strcmp("failure", iks_name(node)) == 0) {
|
||||||
globals.logger(DL_LOG_DEBUG, "sasl authentication failed\n");
|
globals.logger(DL_LOG_DEBUG, "sasl authentication failed\n");
|
||||||
if (handle->session_callback) {
|
if (handle->session_callback) {
|
||||||
handle->session_callback(handle, NULL, LDL_SIGNAL_LOGIN_FAILURE, "user", "core", "Login Failure", handle->login);
|
handle->session_callback(handle, NULL, LDL_SIGNAL_LOGIN_FAILURE, "user", "core", "Login Failure", handle->login);
|
||||||
}
|
}
|
||||||
} else if (strcmp("success", iks_name(node)) == 0) {
|
} else if (node && strcmp("success", iks_name(node)) == 0) {
|
||||||
globals.logger(DL_LOG_DEBUG, "XMPP server connected\n");
|
globals.logger(DL_LOG_DEBUG, "XMPP server connected\n");
|
||||||
iks_send_header(handle->parser, handle->acc->server);
|
iks_send_header(handle->parser, handle->acc->server);
|
||||||
ldl_set_flag_locked(handle, LDL_FLAG_CONNECTED);
|
ldl_set_flag_locked(handle, LDL_FLAG_CONNECTED);
|
||||||
@ -1158,9 +1159,10 @@ static int on_stream(ldl_handle_t *handle, int type, iks *node)
|
|||||||
globals.logger(DL_LOG_DEBUG, "XMPP authenticated\n");
|
globals.logger(DL_LOG_DEBUG, "XMPP authenticated\n");
|
||||||
ldl_set_flag_locked(handle, LDL_FLAG_AUTHORIZED);
|
ldl_set_flag_locked(handle, LDL_FLAG_AUTHORIZED);
|
||||||
}
|
}
|
||||||
|
if (node) {
|
||||||
pak = iks_packet(node);
|
pak = iks_packet(node);
|
||||||
iks_filter_packet(handle->filter, pak);
|
iks_filter_packet(handle->filter, pak);
|
||||||
|
}
|
||||||
if (handle->job_done == 1) {
|
if (handle->job_done == 1) {
|
||||||
return IKS_HOOK;
|
return IKS_HOOK;
|
||||||
}
|
}
|
||||||
@ -1178,8 +1180,9 @@ static int on_stream(ldl_handle_t *handle, int type, iks *node)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node)
|
if (node) {
|
||||||
iks_delete(node);
|
iks_delete(node);
|
||||||
|
}
|
||||||
return IKS_OK;
|
return IKS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user