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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
7c7c1d38
Commit
7c7c1d38
authored
Jun 26, 2023
by
Sébastien Blin
Browse files
Options
Downloads
Patches
Plain Diff
conversationrepository: pin issuer certificate if needed
GitLab:
#868
Change-Id: I2217c9321bc669ba454b54e5b26653399c4939a0
parent
2c32cacd
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/jamidht/conversationrepository.cpp
+19
-10
19 additions, 10 deletions
src/jamidht/conversationrepository.cpp
with
19 additions
and
10 deletions
src/jamidht/conversationrepository.cpp
+
19
−
10
View file @
7c7c1d38
...
...
@@ -194,22 +194,31 @@ public:
if
(
!
repo
or
!
acc
)
return
{};
std
::
map
<
std
::
string
,
std
::
vector
<
DeviceId
>>
memberDevices
;
std
::
string
deviceDir
=
fmt
::
format
(
"{}devices/"
,
git_repository_workdir
(
repo
.
get
()));
std
::
string
deviceDir
=
fmt
::
format
(
"{}devices/"
,
git_repository_workdir
(
repo
.
get
()));
for
(
const
auto
&
file
:
fileutils
::
readDirectory
(
deviceDir
))
{
std
::
shared_ptr
<
dht
::
crypto
::
Certificate
>
cert
;
try
{
cert
=
std
::
make_shared
<
dht
::
crypto
::
Certificate
>
(
fileutils
::
loadFile
(
deviceDir
+
file
));
}
catch
(
const
std
::
exception
&
)
{}
if
(
!
cert
)
continue
;
if
(
ignoreExpired
&&
cert
->
getExpiration
()
<
std
::
chrono
::
system_clock
::
now
())
continue
;
auto
issuerUid
=
cert
->
getIssuerUID
();
if
(
!
acc
->
certStore
().
getCertificate
(
issuerUid
))
{
// Check that parentCert
auto
memberFile
=
fmt
::
format
(
"{}members/{}.crt"
,
git_repository_workdir
(
repo
.
get
()),
issuerUid
);
auto
adminFile
=
fmt
::
format
(
"{}admins/{}.crt"
,
git_repository_workdir
(
repo
.
get
()),
issuerUid
);
auto
parentCert
=
std
::
make_shared
<
dht
::
crypto
::
Certificate
>
(
fileutils
::
loadFile
(
fileutils
::
isFile
(
memberFile
)
?
memberFile
:
adminFile
));
if
(
parentCert
&&
(
ignoreExpired
||
parentCert
->
getExpiration
()
<
std
::
chrono
::
system_clock
::
now
()))
acc
->
certStore
().
pinCertificate
(
parentCert
,
true
);
// Pin certificate to local store if not already done
}
if
(
!
acc
->
certStore
().
getCertificate
(
cert
->
getPublicKey
().
getLongId
().
toString
()))
{
acc
->
certStore
().
pinCertificate
(
cert
,
true
);
// Pin certificate to local store if not already done
}
memberDevices
[
cert
->
getIssuerUID
()].
emplace_back
(
cert
->
getPublicKey
().
getLongId
());
}
catch
(
const
std
::
exception
&
)
{}
}
return
memberDevices
;
}
...
...
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