Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
c288ebcc
Commit
c288ebcc
authored
Dec 12, 2018
by
jehan
Committed by
Matthieu Tanon
Dec 12, 2018
Browse files
Feature/swap db version prior to master merge
parent
94d1716b
Changes
149
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
545 additions
and
208 deletions
+545
-208
CMakeLists.txt
CMakeLists.txt
+10
-0
ChangeLog.md
ChangeLog.md
+2
-0
README.md
README.md
+8
-8
config.h.cmake
config.h.cmake
+1
-0
coreapi/account_creator.c
coreapi/account_creator.c
+172
-11
coreapi/account_creator_private.h
coreapi/account_creator_private.h
+10
-0
coreapi/callbacks.c
coreapi/callbacks.c
+8
-5
coreapi/chat.c
coreapi/chat.c
+20
-2
coreapi/friend.c
coreapi/friend.c
+6
-1
coreapi/friendlist.c
coreapi/friendlist.c
+30
-0
coreapi/im_encryption_engine.c
coreapi/im_encryption_engine.c
+2
-2
coreapi/lime.c
coreapi/lime.c
+6
-54
coreapi/lime.h
coreapi/lime.h
+0
-28
coreapi/linphonecore.c
coreapi/linphonecore.c
+84
-33
coreapi/localplayer.c
coreapi/localplayer.c
+6
-0
coreapi/private_functions.h
coreapi/private_functions.h
+6
-0
coreapi/private_structs.h
coreapi/private_structs.h
+7
-2
coreapi/proxy.c
coreapi/proxy.c
+80
-61
coreapi/remote_provisioning.c
coreapi/remote_provisioning.c
+17
-1
coreapi/tester_utils.h
coreapi/tester_utils.h
+70
-0
No files found.
CMakeLists.txt
View file @
c288ebcc
...
...
@@ -47,6 +47,7 @@ option(ENABLE_DAEMON "Enable the linphone daemon interface." YES)
option
(
ENABLE_DATE
"Use build date in internal version number."
NO
)
option
(
ENABLE_DEBUG_LOGS
"Turn on or off debug level logs."
NO
)
option
(
ENABLE_DOC
"Enable API documentation generation."
NO
)
option
(
ENABLE_LIME_X3DH
"Enable LIMEv2 and X3DH encryption protocol."
YES
)
option
(
ENABLE_JAVA_WRAPPER
"Build the Java wrapper for Liblinphone."
OFF
)
option
(
ENABLE_JAVADOC
"Add a target to generate documentation for Java API"
NO
)
option
(
ENABLE_LDAP
"Enable LDAP support."
NO
)
...
...
@@ -162,6 +163,14 @@ endif()
if
(
ENABLE_ASSISTANT
)
set
(
BUILD_WIZARD 1
)
endif
()
if
(
ENABLE_LIME AND ENABLE_LIME_X3DH
)
message
(
WARNING
"Lime V1 and V2 cannot be used simultaneously! Using Lime V2 only instead."
)
set
(
ENABLE_LIME FALSE
)
endif
()
if
(
ENABLE_LIME_X3DH
)
find_package
(
Lime REQUIRED
)
set
(
HAVE_LIME_X3DH TRUE
)
endif
()
if
(
ENABLE_LIME
)
#bzrtp is only required for LIME
if
(
LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS
)
...
...
@@ -270,6 +279,7 @@ set(STRICT_OPTIONS_OBJC )
if
(
MSVC
)
list
(
APPEND STRICT_OPTIONS_CPP
"/wd4995"
)
# Disable "name was marked as #pragma deprecated" warnings
list
(
APPEND STRICT_OPTIONS_CPP
"/wd4996"
)
# Disable deprecated function warnings
list
(
APPEND STRICT_OPTIONS_CPP
"/wd4800"
)
# Disable warning for cast from bool_t to bool
if
(
ENABLE_STRICT
)
list
(
APPEND STRICT_OPTIONS_CPP
"/WX"
)
endif
()
...
...
ChangeLog.md
View file @
c288ebcc
...
...
@@ -11,6 +11,8 @@ Group changes to describe their impact on the project, as follows:
Security to invite users to upgrade in case of vulnerabilities.
## [Incomming]
-
Implementation of bodyless subscription
-
Parsing of Display name in presence NOTIFY
### Added
-
Avoid some SIP DNS lookups by keeping SRV target names
README.md
View file @
c288ebcc
...
...
@@ -15,19 +15,19 @@ This library is used by Linphone. It's source code is available at *linphone-des
*
**BcToolbox[2]:**
portability layer
*
**BelleSIP[3]:**
SIP stack
*
**Mediastreamer2[4]:**
multimedia engine
*
**Belcard[5]:**
VCard support
*
**Belcard[5]:**
VCard
4
support
*
**libxml2**
*
**zlib**
*
**libsqlite3:**
user data storage (disabl
abl
e)
*
**gettext**
and
**libintl**
: internationalization support (disabl
abl
e)
*
**python interpreter**
and
**pystache**
,
**six**
python module (needed for C++ wrapper and API documenta
i
ton)
*
**libsqlite3:**
user data storage (
can be
disable
d
)
*
**gettext**
and
**libintl**
: internationalization support (
can be
disable
d
)
*
**python interpreter**
and
**pystache**
,
**six**
python module (needed for C++
/C#/Java
wrapper
s
and API documentat
i
on)
*
**doxygen**
and
**dot**
(needed for C++ wrapper and API documentation)
## Optional dependencies
*
**Bzrtp[6]**
: zrtp stack used
for
Linphone Instant Messaging Encryption.
*
For API documentati
n
o generation:
**sphinx**
,
**javasphinx**
,
**sphinx_csharp**
python modules are needed.
*
**Bzrtp[6]**
: zrtp stack used
to secure calls and for LIME (
Linphone Instant Messaging Encryption
)
.
*
For API documentatio
n
generation:
**sphinx**
,
**javasphinx**
,
**sphinx_csharp**
python modules are needed.
## Build instructions
...
...
@@ -47,9 +47,9 @@ This library is used by Linphone. It's source code is available at *linphone-des
*
**`ENABLE_STRICT=NO`**
: build without strict compilation flags (-Wall -Werror)
*
**`ENABLE_DOC=YES`**
: Make the reference documentation of liblinphone to generated
*
**`ENABLE_UNIT_TESTS=NO`**
: do not build testing binaries
*
**`ENABLE_VCARD=NO`**
: disable VCard support
*
**`ENABLE_VCARD=NO`**
: disable VCard
4
support
*
**`ENABLE_TOOLS=NO`**
: do not build tool binaries
*
**`ENABLE_LIME=
YES
`**
: disable Linphone Instant Messaging Encryption
*
**`ENABLE_LIME=
NO
`**
: disable Linphone Instant Messaging Encryption
## Note for packagers
...
...
config.h.cmake
View file @
c288ebcc
...
...
@@ -46,4 +46,5 @@
#cmakedefine HAVE_CU_CURSES 1
#cmakedefine HAVE_LIBUDEV_H 0
#cmakedefine HAVE_LIME
#cmakedefine HAVE_LIME_X3DH
#cmakedefine ENABLE_UPDATE_CHECK 1
coreapi/account_creator.c
View file @
c288ebcc
...
...
@@ -52,10 +52,20 @@ static const char *_get_domain(LinphoneAccountCreator *creator) {
return
linphone_proxy_config_get_domain
(
creator
->
proxy_cfg
);
}
static
const
char
*
ha1_for_passwd
(
const
char
*
username
,
const
char
*
realm
,
const
char
*
passwd
)
{
static
char
ha1
[
33
];
sal_auth_compute_ha1
(
username
,
realm
,
passwd
,
ha1
);
return
ha1
;
static
const
char
*
ha1_for_passwd
(
const
char
*
username
,
const
char
*
realm
,
const
char
*
passwd
,
const
char
*
algo
)
{
if
(
algo
==
NULL
||
strcmp
(
algo
,
"MD5"
)
==
0
)
{
static
char
ha1
[
33
];
sal_auth_compute_ha1
(
username
,
realm
,
passwd
,
ha1
);
return
ha1
;
}
else
if
(
strcmp
(
algo
,
"SHA-256"
)
==
0
)
{
static
char
ha1
[
65
];
sal_auth_compute_ha1_for_algorithm
(
username
,
realm
,
passwd
,
ha1
,
65
,
algo
);
return
ha1
;
}
else
{
return
NULL
;
}
}
static
unsigned
int
validate_uri
(
const
char
*
username
,
const
char
*
domain
,
const
char
*
display_name
)
{
...
...
@@ -205,6 +215,14 @@ void linphone_account_creator_cbs_set_create_account(LinphoneAccountCreatorCbs *
cbs
->
create_account_response_cb
=
cb
;
}
LinphoneAccountCreatorCbsStatusCb
linphone_account_creator_cbs_get_delete_account
(
const
LinphoneAccountCreatorCbs
*
cbs
)
{
return
cbs
->
delete_account_response_cb
;
}
void
linphone_account_creator_cbs_set_delete_account
(
LinphoneAccountCreatorCbs
*
cbs
,
LinphoneAccountCreatorCbsStatusCb
cb
)
{
cbs
->
delete_account_response_cb
=
cb
;
}
LinphoneAccountCreatorCbsStatusCb
linphone_account_creator_cbs_get_is_account_exist
(
const
LinphoneAccountCreatorCbs
*
cbs
)
{
return
cbs
->
is_account_exist_response_cb
;
}
...
...
@@ -213,6 +231,14 @@ void linphone_account_creator_cbs_set_is_account_exist(LinphoneAccountCreatorCbs
cbs
->
is_account_exist_response_cb
=
cb
;
}
LinphoneAccountCreatorCbsStatusCb
linphone_account_creator_cbs_get_get_confirmation_key
(
const
LinphoneAccountCreatorCbs
*
cbs
)
{
return
cbs
->
get_confirmation_key_response_cb
;
}
void
linphone_account_creator_cbs_set_get_confirmation_key
(
LinphoneAccountCreatorCbs
*
cbs
,
LinphoneAccountCreatorCbsStatusCb
cb
)
{
cbs
->
get_confirmation_key_response_cb
=
cb
;
}
LinphoneAccountCreatorCbsStatusCb
linphone_account_creator_cbs_get_activate_account
(
const
LinphoneAccountCreatorCbs
*
cbs
)
{
return
cbs
->
activate_account_response_cb
;
}
...
...
@@ -289,7 +315,9 @@ static void _linphone_account_creator_destroy(LinphoneAccountCreator *creator) {
}
linphone_account_creator_cbs_unref
(
creator
->
cbs
);
linphone_proxy_config_unref
(
creator
->
proxy_cfg
);
if
(
creator
->
proxy_cfg
)
{
linphone_proxy_config_unref
(
creator
->
proxy_cfg
);
}
linphone_account_creator_reset
(
creator
);
}
...
...
@@ -315,9 +343,12 @@ LinphoneAccountCreator * _linphone_account_creator_new(LinphoneCore *core, const
if
(
domain
)
{
linphone_account_creator_set_domain
(
creator
,
domain
);
}
creator
->
proxy_cfg
=
linphone_core_create_proxy_config
(
core
);
if
(
creator
->
service
!=
NULL
&&
linphone_account_creator_service_get_constructor_cb
(
creator
->
service
)
!=
NULL
)
linphone_account_creator_service_get_constructor_cb
(
creator
->
service
)(
creator
);
return
creator
;
}
...
...
@@ -360,6 +391,16 @@ void linphone_account_creator_set_user_data(LinphoneAccountCreator *creator, voi
creator
->
user_data
=
ud
;
}
void
linphone_account_creator_set_proxy_config
(
LinphoneAccountCreator
*
creator
,
LinphoneProxyConfig
*
cfg
)
{
LinphoneProxyConfig
*
old_cfg
=
creator
->
proxy_cfg
;
creator
->
proxy_cfg
=
cfg
?
linphone_proxy_config_ref
(
cfg
)
:
NULL
;
if
(
old_cfg
)
{
linphone_proxy_config_unref
(
old_cfg
);
}
}
LinphoneAccountCreatorUsernameStatus
linphone_account_creator_set_username
(
LinphoneAccountCreator
*
creator
,
const
char
*
username
)
{
int
min_length
=
lp_config_get_int
(
creator
->
core
->
config
,
"assistant"
,
"username_min_length"
,
-
1
);
int
max_length
=
lp_config_get_int
(
creator
->
core
->
config
,
"assistant"
,
"username_max_length"
,
-
1
);
...
...
@@ -457,6 +498,18 @@ const char * linphone_account_creator_get_password(const LinphoneAccountCreator
return
creator
->
password
;
}
LinphoneAccountCreatorAlgoStatus
linphone_account_creator_set_algorithm
(
LinphoneAccountCreator
*
creator
,
const
char
*
algorithm
)
{
set_string
(
&
creator
->
algorithm
,
algorithm
,
FALSE
);
if
(
algorithm
&&
strcmp
(
algorithm
,
"MD5"
)
&&
strcmp
(
algorithm
,
"SHA-256"
))
{
return
LinphoneAccountCreatorAlgoStatusNotSupported
;
}
return
LinphoneAccountCreatorAlgoStatusOk
;
}
const
char
*
linphone_account_creator_get_algorithm
(
const
LinphoneAccountCreator
*
creator
)
{
return
creator
->
algorithm
;
}
LinphoneAccountCreatorPasswordStatus
linphone_account_creator_set_ha1
(
LinphoneAccountCreator
*
creator
,
const
char
*
ha1
){
set_string
(
&
creator
->
ha1
,
ha1
,
FALSE
);
return
LinphoneAccountCreatorPasswordStatusOk
;
...
...
@@ -574,6 +627,24 @@ LinphoneAccountCreatorStatus linphone_account_creator_create_account(LinphoneAcc
return
creator
->
service
->
create_account_request_cb
(
creator
);
}
LinphoneAccountCreatorStatus
linphone_account_creator_delete_account
(
LinphoneAccountCreator
*
creator
)
{
if
(
creator
->
service
->
delete_account_request_cb
==
NULL
||
creator
->
cbs
->
delete_account_response_cb
==
NULL
)
{
return
LinphoneAccountCreatorStatusMissingCallbacks
;
}
return
creator
->
service
->
delete_account_request_cb
(
creator
);
}
LinphoneAccountCreatorStatus
linphone_account_creator_get_confirmation_key
(
LinphoneAccountCreator
*
creator
)
{
if
(
creator
->
service
->
get_confirmation_key_request_cb
==
NULL
||
creator
->
cbs
->
get_confirmation_key_response_cb
==
NULL
)
{
return
LinphoneAccountCreatorStatusMissingCallbacks
;
}
return
creator
->
service
->
get_confirmation_key_request_cb
(
creator
);
}
LinphoneAccountCreatorStatus
linphone_account_creator_is_account_activated
(
LinphoneAccountCreator
*
creator
)
{
if
(
creator
->
service
->
is_account_activated_request_cb
==
NULL
||
creator
->
cbs
->
is_account_activated_response_cb
==
NULL
)
{
...
...
@@ -721,7 +792,7 @@ static void _create_account_cb_custom(LinphoneXmlRpcRequest *request) {
:
(
strcmp
(
resp
,
"ERROR_CANNOT_SEND_SMS"
)
==
0
)
?
LinphoneAccountCreatorStatusServerError
:
(
strcmp
(
resp
,
"ERROR_ACCOUNT_ALREADY_IN_USE"
)
==
0
)
?
LinphoneAccountCreatorStatusAccountExist
:
(
strcmp
(
resp
,
"ERROR_ALIAS_ALREADY_IN_USE"
)
==
0
)
?
LinphoneAccountCreatorStatusAccountExistWithAlias
:
LinphoneAccountCreatorStatusAccountNotCreated
;
:
LinphoneAccountCreatorStatusAccountNotCreated
;
}
creator
->
cbs
->
create_account_response_cb
(
creator
,
status
,
resp
);
}
...
...
@@ -742,10 +813,11 @@ static LinphoneXmlRpcRequest * _create_account_with_phone_custom(LinphoneAccount
linphone_xml_rpc_request_add_string_arg
(
request
,
creator
->
phone_number
);
linphone_xml_rpc_request_add_string_arg
(
request
,
creator
->
username
?
creator
->
username
:
creator
->
phone_number
);
linphone_xml_rpc_request_add_string_arg
(
request
,
creator
->
password
?
ha1_for_passwd
(
creator
->
username
?
creator
->
username
:
creator
->
phone_number
,
_get_domain
(
creator
),
creator
->
password
)
:
""
);
ha1_for_passwd
(
creator
->
username
?
creator
->
username
:
creator
->
phone_number
,
_get_domain
(
creator
),
creator
->
password
,
creator
->
algorithm
)
:
""
);
linphone_xml_rpc_request_add_string_arg
(
request
,
linphone_core_get_user_agent
(
creator
->
core
));
linphone_xml_rpc_request_add_string_arg
(
request
,
_get_domain
(
creator
));
linphone_xml_rpc_request_add_string_arg
(
request
,
creator
->
language
);
linphone_xml_rpc_request_add_string_arg
(
request
,
creator
->
algorithm
);
return
request
;
}
...
...
@@ -763,9 +835,10 @@ static LinphoneXmlRpcRequest * _create_account_with_email_custom(LinphoneAccount
linphone_xml_rpc_request_add_string_arg
(
request
,
creator
->
username
);
linphone_xml_rpc_request_add_string_arg
(
request
,
creator
->
email
);
linphone_xml_rpc_request_add_string_arg
(
request
,
ha1_for_passwd
(
creator
->
username
?
creator
->
username
:
creator
->
phone_number
,
_get_domain
(
creator
),
creator
->
password
));
ha1_for_passwd
(
creator
->
username
?
creator
->
username
:
creator
->
phone_number
,
_get_domain
(
creator
),
creator
->
password
,
creator
->
algorithm
));
linphone_xml_rpc_request_add_string_arg
(
request
,
linphone_core_get_user_agent
(
creator
->
core
));
linphone_xml_rpc_request_add_string_arg
(
request
,
_get_domain
(
creator
));
linphone_xml_rpc_request_add_string_arg
(
request
,
creator
->
algorithm
);
return
request
;
}
...
...
@@ -792,6 +865,45 @@ LinphoneAccountCreatorStatus linphone_account_creator_create_account_linphone(Li
ms_free
(
identity
);
return
LinphoneAccountCreatorStatusRequestFailed
;
}
static
void
_delete_linphone_account_response_cb
(
LinphoneXmlRpcRequest
*
request
)
{
LinphoneAccountCreator
*
creator
=
(
LinphoneAccountCreator
*
)
linphone_xml_rpc_request_get_user_data
(
request
);
if
(
creator
->
cbs
->
delete_account_response_cb
!=
NULL
)
{
LinphoneAccountCreatorStatus
status
=
LinphoneAccountCreatorStatusRequestFailed
;
const
char
*
resp
=
linphone_xml_rpc_request_get_string_response
(
request
);
if
(
linphone_xml_rpc_request_get_status
(
request
)
==
LinphoneXmlRpcStatusOk
)
{
status
=
(
strcmp
(
resp
,
"OK"
)
==
0
)
?
LinphoneAccountCreatorStatusAccountCreated
:
(
strcmp
(
resp
,
"ERROR_USERNAME_PARAMETER_NOT_FOUND"
)
==
0
)
?
LinphoneAccountCreatorStatusMissingArguments
:
(
strcmp
(
resp
,
"ERROR_ACCOUNT_DOESNT_EXIST"
)
==
0
)
?
LinphoneAccountCreatorStatusAccountNotExist
:
(
strstr
(
resp
,
"ERROR_"
)
==
0
)
?
LinphoneAccountCreatorStatusRequestFailed
:
LinphoneAccountCreatorStatusAccountNotCreated
;
}
creator
->
cbs
->
create_account_response_cb
(
creator
,
status
,
resp
);
}
}
LinphoneAccountCreatorStatus
linphone_account_creator_delete_account_linphone
(
LinphoneAccountCreator
*
creator
)
{
if
((
!
creator
->
username
&&
!
creator
->
phone_number
)
||
!
creator
->
password
)
{
return
LinphoneAccountCreatorStatusMissingArguments
;
}
ms_debug
(
"Account creator: delete_account (username=%s, password=%s, domain=%s)"
,
creator
->
username
,
creator
->
password
,
linphone_proxy_config_get_domain
(
creator
->
proxy_cfg
));
LinphoneXmlRpcRequest
*
request
=
linphone_xml_rpc_request_new
(
LinphoneXmlRpcArgString
,
"delete_account"
);
linphone_xml_rpc_request_add_string_arg
(
request
,
creator
->
username
?
creator
->
username
:
creator
->
phone_number
);
linphone_xml_rpc_request_add_string_arg
(
request
,
creator
->
password
);
linphone_xml_rpc_request_add_string_arg
(
request
,
linphone_proxy_config_get_domain
(
creator
->
proxy_cfg
));
linphone_xml_rpc_request_set_user_data
(
request
,
creator
);
linphone_xml_rpc_request_cbs_set_response
(
linphone_xml_rpc_request_get_callbacks
(
request
),
_delete_linphone_account_response_cb
);
linphone_xml_rpc_session_send_request
(
creator
->
xmlrpc_session
,
request
);
linphone_xml_rpc_request_unref
(
request
);
return
LinphoneAccountCreatorStatusRequestOk
;
}
/****************** END OF CREATE ACCOUNT SECTION *****************************/
/****************** START OF VALIDATE ACCOUNT SECTION *************************/
...
...
@@ -835,6 +947,7 @@ LinphoneAccountCreatorStatus linphone_account_creator_activate_account_linphone(
linphone_xml_rpc_request_add_string_arg
(
request
,
creator
->
username
?
creator
->
username
:
creator
->
phone_number
);
linphone_xml_rpc_request_add_string_arg
(
request
,
creator
->
activation_code
);
linphone_xml_rpc_request_add_string_arg
(
request
,
_get_domain
(
creator
));
linphone_xml_rpc_request_add_string_arg
(
request
,
creator
->
algorithm
);
linphone_xml_rpc_request_set_user_data
(
request
,
creator
);
linphone_xml_rpc_request_cbs_set_response
(
linphone_xml_rpc_request_get_callbacks
(
request
),
_activate_account_cb_custom
);
linphone_xml_rpc_session_send_request
(
creator
->
xmlrpc_session
,
request
);
...
...
@@ -871,6 +984,52 @@ LinphoneAccountCreatorStatus linphone_account_creator_activate_email_account_lin
}
return
LinphoneAccountCreatorStatusRequestFailed
;
}
static
void
get_linphone_confirmation_key_response_cb
(
LinphoneXmlRpcRequest
*
request
)
{
LinphoneAccountCreator
*
creator
=
(
LinphoneAccountCreator
*
)
linphone_xml_rpc_request_get_user_data
(
request
);
if
(
creator
->
cbs
->
get_confirmation_key_response_cb
!=
NULL
)
{
LinphoneAccountCreatorStatus
status
=
LinphoneAccountCreatorStatusRequestFailed
;
const
char
*
resp
=
linphone_xml_rpc_request_get_string_response
(
request
);
if
(
linphone_xml_rpc_request_get_status
(
request
)
==
LinphoneXmlRpcStatusOk
)
{
if
(
strcmp
(
resp
,
"ERROR_USERNAME_PARAMETER_NOT_FOUND"
)
==
0
)
{
status
=
LinphoneAccountCreatorStatusMissingArguments
;
}
else
if
(
strcmp
(
resp
,
"ERROR_ACCOUNT_DOESNT_EXIST"
)
==
0
)
{
status
=
LinphoneAccountCreatorStatusAccountNotExist
;
}
else
if
(
strstr
(
resp
,
"ERROR_"
)
==
resp
)
{
status
=
LinphoneAccountCreatorStatusRequestFailed
;
}
else
{
status
=
LinphoneAccountCreatorStatusRequestOk
;
set_string
(
&
creator
->
activation_code
,
resp
,
FALSE
);
}
}
creator
->
cbs
->
get_confirmation_key_response_cb
(
creator
,
status
,
resp
);
}
}
LinphoneAccountCreatorStatus
linphone_account_creator_get_confirmation_key_linphone
(
LinphoneAccountCreator
*
creator
)
{
if
(
!
creator
->
username
||
!
creator
->
password
)
{
if
(
creator
->
cbs
->
get_confirmation_key_response_cb
!=
NULL
)
{
creator
->
cbs
->
get_confirmation_key_response_cb
(
creator
,
LinphoneAccountCreatorStatusMissingArguments
,
"Missing required parameters"
);
}
return
LinphoneAccountCreatorStatusMissingArguments
;
}
ms_debug
(
"Account creator: get_confirmation_key (username=%s, password=%s, domain=%s)"
,
creator
->
username
,
creator
->
password
,
linphone_proxy_config_get_domain
(
creator
->
proxy_cfg
));
LinphoneXmlRpcRequest
*
request
=
linphone_xml_rpc_request_new
(
LinphoneXmlRpcArgString
,
"get_confirmation_key"
);
linphone_xml_rpc_request_add_string_arg
(
request
,
creator
->
username
);
linphone_xml_rpc_request_add_string_arg
(
request
,
ha1_for_passwd
(
creator
->
username
,
linphone_proxy_config_get_domain
(
creator
->
proxy_cfg
),
creator
->
password
,
creator
->
algorithm
));
linphone_xml_rpc_request_add_string_arg
(
request
,
linphone_proxy_config_get_domain
(
creator
->
proxy_cfg
));
linphone_xml_rpc_request_add_string_arg
(
request
,
creator
->
algorithm
);
linphone_xml_rpc_request_set_user_data
(
request
,
creator
);
linphone_xml_rpc_request_cbs_set_response
(
linphone_xml_rpc_request_get_callbacks
(
request
),
get_linphone_confirmation_key_response_cb
);
linphone_xml_rpc_session_send_request
(
creator
->
xmlrpc_session
,
request
);
linphone_xml_rpc_request_unref
(
request
);
return
LinphoneAccountCreatorStatusRequestOk
;
}
/****************** END OF CREATE VALIDATE ACCOUNT SECTION ********************/
/****************** START OF ACCOUNT VALIDATED SECTION ************************/
...
...
@@ -1077,8 +1236,9 @@ LinphoneAccountCreatorStatus linphone_account_creator_activate_phone_number_link
linphone_xml_rpc_request_add_string_arg
(
request
,
creator
->
phone_number
);
linphone_xml_rpc_request_add_string_arg
(
request
,
creator
->
username
);
linphone_xml_rpc_request_add_string_arg
(
request
,
creator
->
activation_code
);
linphone_xml_rpc_request_add_string_arg
(
request
,
creator
->
ha1
?
creator
->
ha1
:
ha1_for_passwd
(
creator
->
username
,
_get_domain
(
creator
),
creator
->
password
));
linphone_xml_rpc_request_add_string_arg
(
request
,
creator
->
ha1
?
creator
->
ha1
:
ha1_for_passwd
(
creator
->
username
,
_get_domain
(
creator
),
creator
->
password
,
creator
->
algorithm
));
linphone_xml_rpc_request_add_string_arg
(
request
,
_get_domain
(
creator
));
linphone_xml_rpc_request_add_string_arg
(
request
,
creator
->
algorithm
);
linphone_xml_rpc_request_set_user_data
(
request
,
creator
);
linphone_xml_rpc_request_cbs_set_response
(
linphone_xml_rpc_request_get_callbacks
(
request
),
_activate_phone_number_link_cb_custom
);
linphone_xml_rpc_session_send_request
(
creator
->
xmlrpc_session
,
request
);
...
...
@@ -1176,8 +1336,8 @@ LinphoneAccountCreatorStatus linphone_account_creator_update_password_linphone(L
if
(
creator
->
xmlrpc_session
)
{
const
char
*
username
=
creator
->
username
?
creator
->
username
:
creator
->
phone_number
;
char
*
ha1
=
bctbx_strdup
(
creator
->
ha1
?
creator
->
ha1
:
ha1_for_passwd
(
username
,
_get_domain
(
creator
),
creator
->
password
)
);
char
*
new_ha1
=
bctbx_strdup
(
ha1_for_passwd
(
username
,
_get_domain
(
creator
),
new_pwd
));
char
*
ha1
=
bctbx_strdup
(
creator
->
ha1
?
creator
->
ha1
:
ha1_for_passwd
(
username
,
_get_domain
(
creator
),
creator
->
password
,
creator
->
algorithm
));
char
*
new_ha1
=
bctbx_strdup
(
ha1_for_passwd
(
username
,
_get_domain
(
creator
),
new_pwd
,
creator
->
algorithm
));
ms_debug
(
"Account creator: update_password (username=%s, domain=%s)"
,
creator
->
username
,
...
...
@@ -1188,6 +1348,7 @@ LinphoneAccountCreatorStatus linphone_account_creator_update_password_linphone(L
linphone_xml_rpc_request_add_string_arg
(
request
,
ha1
);
linphone_xml_rpc_request_add_string_arg
(
request
,
new_ha1
);
linphone_xml_rpc_request_add_string_arg
(
request
,
_get_domain
(
creator
));
linphone_xml_rpc_request_add_string_arg
(
request
,
creator
->
algorithm
);
linphone_xml_rpc_request_set_user_data
(
request
,
creator
);
linphone_xml_rpc_request_cbs_set_response
(
linphone_xml_rpc_request_get_callbacks
(
request
),
_password_updated_cb_custom
);
linphone_xml_rpc_session_send_request
(
creator
->
xmlrpc_session
,
request
);
...
...
coreapi/account_creator_private.h
View file @
c288ebcc
...
...
@@ -33,7 +33,9 @@ struct _LinphoneAccountCreatorService {
LinphoneAccountCreatorRequestFunc
account_creator_service_destructor_cb
;
/**< Destructor */
LinphoneAccountCreatorRequestFunc
create_account_request_cb
;
/**< Request to create account */
LinphoneAccountCreatorRequestFunc
delete_account_request_cb
;
/**< Request to delete account */
LinphoneAccountCreatorRequestFunc
is_account_exist_request_cb
;
/**< Request to know if account exist */
LinphoneAccountCreatorRequestFunc
get_confirmation_key_request_cb
;
/**< Request to get the confirmation key */
LinphoneAccountCreatorRequestFunc
activate_account_request_cb
;
/**< Request to activate account */
LinphoneAccountCreatorRequestFunc
is_account_activated_request_cb
;
/**< Request to know if account is activated */
...
...
@@ -54,10 +56,12 @@ struct _LinphoneAccountCreatorCbs {
void
*
user_data
;
LinphoneAccountCreatorCbsStatusCb
create_account_response_cb
;
/**< Response of create_account request */
LinphoneAccountCreatorCbsStatusCb
delete_account_response_cb
;
/**< Response of delete_account request */
LinphoneAccountCreatorCbsStatusCb
is_account_exist_response_cb
;
/**< Response of is_account_exist request */
LinphoneAccountCreatorCbsStatusCb
activate_account_response_cb
;
/**< Response of activate_account request */
LinphoneAccountCreatorCbsStatusCb
is_account_activated_response_cb
;
/**< Response of is_account_activated request */
LinphoneAccountCreatorCbsStatusCb
get_confirmation_key_response_cb
;
/**< Response of get_confirmation_key request */
LinphoneAccountCreatorCbsStatusCb
link_account_response_cb
;
/**< Response of link_account request */
LinphoneAccountCreatorCbsStatusCb
activate_alias_response_cb
;
/**< Response of activation alias */
...
...
@@ -96,8 +100,14 @@ struct _LinphoneAccountCreator {
char
*
language
;
/**< User language */
char
*
activation_code
;
/**< Account validation code */
char
*
domain
;
/**< Domain */
char
*
algorithm
;
/**< Digest authentication algorithm */
LinphoneTransportType
transport
;
/**< Transport used */
// test
bool_t
account_created
;
bool_t
confirmation_key_received
;
bool_t
account_activated
;
/* Deprecated */
char
*
route
;
};
...
...
coreapi/callbacks.c
View file @
c288ebcc
...
...
@@ -93,8 +93,8 @@ static void call_received(SalCallOp *h) {
linphone_address_unref
(
toAddr
);
linphone_address_unref
(
fromAddr
);
if
(
sal_address_has_param
(
h
->
getRemoteContactAddress
(),
"text"
))
{
const
char
*
oneToOneChatRoom
Str
=
sal_custom_header_find
(
h
->
getRecvCustomHeaders
(),
"One-To-One-Chat-Room"
);
if
(
oneToOneChatRoom
Str
&&
(
strcmp
(
oneToOneChatRoomStr
,
"true"
)
==
0
)
)
{
string
oneToOneChatRoom
=
L_C_TO_STRING
(
sal_custom_header_find
(
h
->
getRecvCustomHeaders
(),
"One-To-One-Chat-Room"
)
)
;
if
(
oneToOneChatRoom
==
"true"
)
{
bool_t
oneToOneChatRoomEnabled
=
linphone_config_get_bool
(
linphone_core_get_config
(
lc
),
"misc"
,
"enable_one_to_one_chat_room"
,
TRUE
);
if
(
!
oneToOneChatRoomEnabled
)
{
h
->
decline
(
SalReasonNotAcceptable
);
...
...
@@ -147,10 +147,13 @@ static void call_received(SalCallOp *h) {
chatRoom
->
deleteFromDb
();
chatRoom
.
reset
();
}
if
(
!
chatRoom
)
if
(
!
chatRoom
)
{
string
endToEndEncrypted
=
L_C_TO_STRING
(
sal_custom_header_find
(
h
->
getRecvCustomHeaders
(),
"End-To-End-Encrypted"
));
bool
encrypted
=
(
endToEndEncrypted
==
"true"
);
chatRoom
=
L_GET_PRIVATE_FROM_C_OBJECT
(
lc
)
->
createClientGroupChatRoom
(
h
->
getSubject
(),
h
->
getRemoteContact
(),
h
->
getRemoteBody
(),
false
h
->
getSubject
(),
h
->
getRemoteContact
(),
h
->
getRemoteBody
(),
false
,
encrypted
);
}
const
char
*
oneToOneChatRoomStr
=
sal_custom_header_find
(
h
->
getRecvCustomHeaders
(),
"One-To-One-Chat-Room"
);
if
(
oneToOneChatRoomStr
&&
(
strcmp
(
oneToOneChatRoomStr
,
"true"
)
==
0
))
...
...
@@ -853,7 +856,7 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){
ConferenceId
(
addr
,
IdentityAddress
(
op
->
getTo
()))
);
if
(
!
chatRoom
)
chatRoom
=
L_GET_PRIVATE_FROM_C_OBJECT
(
lc
)
->
createClientGroupChatRoom
(
""
,
addr
.
asString
(),
Content
(),
false
);
chatRoom
=
L_GET_PRIVATE_FROM_C_OBJECT
(
lc
)
->
createClientGroupChatRoom
(
""
,
addr
.
asString
(),
Content
(),
false
,
false
);
chatRoom
->
join
();
static_cast
<
SalReferOp
*>
(
op
)
->
reply
(
SalReasonNone
);
return
;
...
...
coreapi/chat.c
View file @
c288ebcc
...
...
@@ -99,6 +99,10 @@ LinphoneChatRoom *linphone_core_create_client_group_chat_room (LinphoneCore *lc,
return
L_GET_C_BACK_PTR
(
L_GET_CPP_PTR_FROM_C_OBJECT
(
lc
)
->
createClientGroupChatRoom
(
L_C_TO_STRING
(
subject
),
!!
fallback
));
}
LinphoneChatRoom
*
linphone_core_create_client_group_chat_room_2
(
LinphoneCore
*
lc
,
const
char
*
subject
,
bool_t
fallback
,
bool_t
encrypted
)
{
return
L_GET_C_BACK_PTR
(
L_GET_CPP_PTR_FROM_C_OBJECT
(
lc
)
->
createClientGroupChatRoom
(
L_C_TO_STRING
(
subject
),
!!
fallback
,
!!
encrypted
));
}
LinphoneChatRoom
*
_linphone_core_create_server_group_chat_room
(
LinphoneCore
*
lc
,
LinphonePrivate
::
SalCallOp
*
op
)
{
return
_linphone_server_group_chat_room_new
(
lc
,
op
);
}
...
...
@@ -129,8 +133,22 @@ LinphoneChatRoom *linphone_core_find_one_to_one_chat_room (
)
{
return
L_GET_C_BACK_PTR
(
L_GET_CPP_PTR_FROM_C_OBJECT
(
lc
)
->
findOneToOneChatRoom
(
LinphonePrivate
::
IdentityAddress
(
*
L_GET_CPP_PTR_FROM_C_OBJECT
(
local_addr
)),
LinphonePrivate
::
IdentityAddress
(
*
L_GET_CPP_PTR_FROM_C_OBJECT
(
participant_addr
))
));
LinphonePrivate
::
IdentityAddress
(
*
L_GET_CPP_PTR_FROM_C_OBJECT
(
participant_addr
)),
false
)
);
}
LinphoneChatRoom
*
linphone_core_find_one_to_one_chat_room_2
(
const
LinphoneCore
*
lc
,
const
LinphoneAddress
*
local_addr
,
const
LinphoneAddress
*
participant_addr
,
bool_t
encrypted
)
{
return
L_GET_C_BACK_PTR
(
L_GET_CPP_PTR_FROM_C_OBJECT
(
lc
)
->
findOneToOneChatRoom
(
LinphonePrivate
::
IdentityAddress
(
*
L_GET_CPP_PTR_FROM_C_OBJECT
(
local_addr
)),
LinphonePrivate
::
IdentityAddress
(
*
L_GET_CPP_PTR_FROM_C_OBJECT
(
participant_addr
)),
!!
encrypted
)
);
}
int
linphone_core_message_received
(
LinphoneCore
*
lc
,
LinphonePrivate
::
SalOp
*
op
,
const
SalMessage
*
sal_msg
)
{
...
...
coreapi/friend.c
View file @
c288ebcc
...
...
@@ -866,7 +866,12 @@ LinphoneFriend * linphone_core_create_friend_with_address(LinphoneCore *lc, cons
#endif
void
linphone_core_add_friend
(
LinphoneCore
*
lc
,
LinphoneFriend
*
lf
)
{
if
(
linphone_friend_list_add_friend
(
linphone_core_get_default_friend_list
(
lc
),
lf
)
!=
LinphoneFriendListOK
)
return
;
LinphoneFriendList
*
friendList
=
linphone_core_get_default_friend_list
(
lc
);
if
(
!
friendList
)
{
friendList
=
linphone_core_create_friend_list
(
lc
);
linphone_core_add_friend_list
(
lc
,
friendList
);
}
if
(
linphone_friend_list_add_friend
(
friendList
,
lf
)
!=
LinphoneFriendListOK
)
return
;
if
(
bctbx_list_find
(
lc
->
subscribers
,
lf
))
{
/*if this friend was in the pending subscriber list, now remove it from this list*/
lc
->
subscribers
=
bctbx_list_remove
(
lc
->
subscribers
,
lf
);
...
...
coreapi/friendlist.c
View file @
c288ebcc
...
...
@@ -218,6 +218,7 @@ static void linphone_friend_list_parse_multipart_related_body(LinphoneFriendList
LinphoneFriend
*
lf
;
LinphoneContent
*
presence_part
;
xmlXPathObjectPtr
resource_object
;
xmlXPathObjectPtr
name_object
;
char
*
version_str
=
NULL
;
char
*
full_state_str
=
NULL
;
char
*
uri
=
NULL
;
...
...
@@ -261,6 +262,35 @@ static void linphone_friend_list_parse_multipart_related_body(LinphoneFriendList
}
list
->
expected_notification_version
=
version
+
1
;
name_object
=
linphone_get_xml_xpath_object_for_node_list
(
xml_ctx
,
"/rlmi:list/rlmi:resource/rlmi:name/.."
);
if
(
name_object
&&
name_object
->
nodesetval
)
{
for
(
i
=
1
;
i
<=
name_object
->
nodesetval
->
nodeNr
;
i
++
)
{
char
*
name
=
NULL
;
LinphoneAddress
*
addr
;
linphone_xml_xpath_context_set_node
(
xml_ctx
,
xmlXPathNodeSetItem
(
name_object
->
nodesetval
,
i
-
1
));
name
=
linphone_get_xml_text_content
(
xml_ctx
,
"./rlmi:name"
);
uri
=
linphone_get_xml_text_content
(
xml_ctx
,
"./@uri"
);
if
(
!
uri
)
continue
;
addr
=
linphone_address_new
(
uri
);
if
(
!
addr
)
continue
;
lf
=
linphone_friend_list_find_friend_by_address
(
list
,
addr
);
linphone_address_unref
(
addr
);
if
(
!
lf
&&
list
->
bodyless_subscription
)
{
lf
=
linphone_core_create_friend_with_address
(
list
->
lc
,
uri
);
linphone_friend_list_add_friend
(
list
,
lf
);
linphone_friend_unref
(
lf
);
}
if
(
name
)
{
linphone_friend_set_name
(
lf
,
name
);
linphone_free_xml_text_content
(
name
);
}
}
}
if
(
name_object
)
xmlXPathFreeObject
(
name_object
);
resource_object
=
linphone_get_xml_xpath_object_for_node_list
(
xml_ctx
,
"/rlmi:list/rlmi:resource/rlmi:instance[@state=
\"
active
\"
]/.."
);
if
(
resource_object
&&
resource_object
->
nodesetval
)
{
for
(
i
=
1
;
i
<=
resource_object
->
nodesetval
->
nodeNr
;
i
++
)
{
...
...
coreapi/im_encryption_engine.c
View file @
c288ebcc
...
...
@@ -117,11 +117,11 @@ void linphone_im_encryption_engine_cbs_set_process_outgoing_message(LinphoneImEn
}
LinphoneImEncryptionEngineCbsDownloadingFileCb
linphone_im_encryption_engine_cbs_get_process_downloading_file
(
LinphoneImEncryptionEngineCbs
*
cbs
)
{
return
cbs
->
process_downlading_file
;
return
cbs
->
process_downl
o
ading_file
;
}
void
linphone_im_encryption_engine_cbs_set_process_downloading_file
(
LinphoneImEncryptionEngineCbs
*
cbs
,
LinphoneImEncryptionEngineCbsDownloadingFileCb
cb
)
{
cbs
->
process_downlading_file
=
cb
;
cbs
->
process_downl
o
ading_file
=
cb
;
}
LinphoneImEncryptionEngineCbsUploadingFileCb
linphone_im_encryption_engine_cbs_get_process_uploading_file
(
LinphoneImEncryptionEngineCbs
*
cbs
)
{
...
...
coreapi/lime.c
View file @
c288ebcc
...
...
@@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "linphone/api/c-content.h"
#include "bctoolbox/crypto.h"
#include "lime.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
...
...
@@ -26,7 +27,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifdef HAVE_LIME
#include "private.h"
#include "bctoolbox/crypto.h"
#include "bctoolbox/port.h"
#include "bzrtp/bzrtp.h"
...
...
@@ -399,53 +399,6 @@ int lime_encryptMessage(limeKey_t *key, const uint8_t *plainMessage, uint32_t me
return
0
;
}
int
lime_encryptFile
(
void
**
cryptoContext
,
unsigned
char
*
key
,
size_t
length
,
char
*
plain
,
char
*
cipher
)
{
bctbx_aes_gcm_context_t
*
gcmContext
;