Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
37ba1dca
Commit
37ba1dca
authored
14 years ago
by
Alexandre Savard
Browse files
Options
Downloads
Patches
Plain Diff
[#3648] Implement credential serialization
parent
fd8e77db
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
sflphone-common/src/managerimpl.h
+1
-2
1 addition, 2 deletions
sflphone-common/src/managerimpl.h
sflphone-common/src/sip/sipaccount.cpp
+27
-2
27 additions, 2 deletions
sflphone-common/src/sip/sipaccount.cpp
sflphone-common/src/sip/sipaccount.h
+31
-0
31 additions, 0 deletions
sflphone-common/src/sip/sipaccount.h
with
59 additions
and
4 deletions
sflphone-common/src/managerimpl.h
+
1
−
2
View file @
37ba1dca
...
...
@@ -113,6 +113,7 @@ class ManagerImpl {
ManagerImpl
(
void
);
~
ManagerImpl
(
void
);
Preferences
preferences
;
short
buildConfiguration
();
...
...
@@ -1347,8 +1348,6 @@ private:
Conf
::
YamlParser
*
parser
;
Preferences
preferences
;
#ifdef TEST
bool
testCallAccountMap
();
bool
testAccountMap
();
...
...
This diff is collapsed.
Click to expand it.
sflphone-common/src/sip/sipaccount.cpp
+
27
−
2
View file @
37ba1dca
...
...
@@ -36,6 +36,28 @@
#include
<pwd.h>
Credentials
::
Credentials
()
:
credentialCount
(
0
)
{}
Credentials
::~
Credentials
()
{}
void
Credentials
::
serialize
(
Engine
*
engine
)
{
}
void
Credentials
::
unserialize
(
Conf
::
MappingNode
*
map
)
{
Conf
::
ScalarNode
*
val
=
NULL
;
_debug
(
"SipAccount: Unserialize"
);
val
=
(
Conf
::
ScalarNode
*
)(
map
->
getValue
(
credentialCountKey
));
if
(
val
)
{
credentialCount
=
atoi
(
val
->
getValue
().
data
());
val
=
NULL
;
}
}
SIPAccount
::
SIPAccount
(
const
AccountID
&
accountID
)
:
Account
(
accountID
,
"sip"
)
,
_routeSet
(
""
)
...
...
@@ -122,6 +144,7 @@ void SIPAccount::unserialize(Conf::MappingNode *map)
Conf
::
MappingNode
*
srtpMap
;
Conf
::
MappingNode
*
tlsMap
;
Conf
::
MappingNode
*
zrtpMap
;
Conf
::
MappingNode
*
credMap
;
_debug
(
"SipAccount: Unserialize"
);
...
...
@@ -167,6 +190,8 @@ void SIPAccount::unserialize(Conf::MappingNode *map)
// _dtmfType = atoi(val->getValue();
// stun enabled
credMap
=
(
Conf
::
MappingNode
*
)(
map
->
getValue
(
credKey
));
credentials
.
unserialize
(
credMap
);
// get srtp submap
srtpMap
=
(
Conf
::
MappingNode
*
)(
map
->
getValue
(
srtpKey
));
...
...
@@ -242,12 +267,12 @@ void SIPAccount::setVoIPLink() {
int
SIPAccount
::
initCredential
(
void
)
{
int
credentialCount
=
0
;
credentialCount
=
Manager
::
instance
().
getConfigInt
(
_accountID
,
CONFIG_CREDENTIAL_NUMBER
);
credentialCount
=
credentials
.
getCredentialCount
();
//
Manager::instance().getConfigInt (_accountID, CONFIG_CREDENTIAL_NUMBER);
credentialCount
+=
1
;
bool
md5HashingEnabled
=
false
;
int
dataType
=
0
;
md5HashingEnabled
=
Manager
::
instance
().
getConfigBool
(
PREFERENCES
,
CONFIG_MD5HASH
);
md5HashingEnabled
=
Manager
::
instance
().
preferences
.
getMd5Hash
();
//
Manager::instance().getConfigBool (PREFERENCES, CONFIG_MD5HASH);
std
::
string
digest
;
// Create the credential array
...
...
This diff is collapsed.
Click to expand it.
sflphone-common/src/sip/sipaccount.h
+
31
−
0
View file @
37ba1dca
...
...
@@ -43,6 +43,7 @@
#include
"pjsip/sip_types.h"
#include
"config/serializable.h"
#include
<exception>
#include
<map>
enum
DtmfType
{
OVERRTP
,
SIPINFO
};
...
...
@@ -89,6 +90,9 @@ const Conf::Key serverKey("server");
const
Conf
::
Key
verifyClientKey
(
"verifyClient"
);
const
Conf
::
Key
verifyServerKey
(
"verifyServer"
);
const
Conf
::
Key
credKey
(
"credential"
);
const
Conf
::
Key
credentialCountKey
(
"count"
);
class
SIPVoIPLink
;
/**
...
...
@@ -115,6 +119,32 @@ class SipAccountException : public std::exception
};
class
Credentials
:
public
Serializable
{
public:
typedef
std
::
map
<
std
::
string
,
std
::
string
>
CredentialMap
;
Credentials
();
~
Credentials
();
virtual
void
serialize
(
Engine
*
engine
);
virtual
void
unserialize
(
Conf
::
MappingNode
*
map
);
int
getCredentialCount
(
void
)
{
return
credentialCount
;
}
void
setCredentialCount
(
int
count
)
{
credentialCount
=
count
;
}
private
:
int
credentialCount
;
CredentialMap
credentialMap
;
};
class
SIPAccount
:
public
Account
{
public:
...
...
@@ -546,6 +576,7 @@ class SIPAccount : public Account
pjsip_cred_info
*
_cred
;
std
::
string
_realm
;
std
::
string
_authenticationUsername
;
Credentials
credentials
;
// The TLS settings, if tls is chosen as
// a sip transport.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment