Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
e3dd12fa
Kaydet (Commit)
e3dd12fa
authored
Şub 24, 2018
tarafından
Eike Rathke
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Handle mbEmptyPass and empty hash with OOXML hash value, tdf#104250 prep
Change-Id: Ib24102c442c4675cc5b256fcf8e9d81370aba11f
üst
0423db15
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
9 deletions
+28
-9
tabprotection.cxx
sc/source/core/data/tabprotection.cxx
+28
-9
No files found.
sc/source/core/data/tabprotection.cxx
Dosyayı görüntüle @
e3dd12fa
...
...
@@ -330,6 +330,20 @@ void ScTableProtectionImpl::setPasswordHash(
void
ScTableProtectionImpl
::
setPasswordHash
(
const
OUString
&
rAlgorithmName
,
const
OUString
&
rHashValue
,
const
OUString
&
rSaltValue
,
sal_uInt32
nSpinCount
)
{
if
(
!
rHashValue
.
isEmpty
())
{
// Invalidate the other hashes.
setPasswordHash
(
uno
::
Sequence
<
sal_Int8
>
(),
PASSHASH_UNSPECIFIED
,
PASSHASH_UNSPECIFIED
);
// We don't know whether this is an empty password (or would
// unnecessarily have to try to verify an empty password), assume it is
// not. A later verifyPassword() with an empty password will determine.
// If this was not set to false then a verifyPassword() with an empty
// password would unlock even if this hash here wasn't for an empty
// password. Ugly stuff.
mbEmptyPass
=
false
;
}
maPasswordHash
.
maAlgorithmName
=
rAlgorithmName
;
maPasswordHash
.
maHashValue
=
rHashValue
;
maPasswordHash
.
maSaltValue
=
rSaltValue
;
...
...
@@ -350,19 +364,24 @@ bool ScTableProtectionImpl::verifyPassword(const OUString& aPassText) const
// Clear text password exists, and this one takes precedence.
return
aPassText
==
maPassText
;
Sequence
<
sal_Int8
>
aHash
=
hashPassword
(
aPassText
,
meHash1
);
aHash
=
hashPassword
(
aHash
,
meHash2
);
// For PASSHASH_UNSPECIFIED also maPassHash is empty and any aPassText
// would yield an empty hash as well and thus compare true. Don't.
if
(
meHash1
!=
PASSHASH_UNSPECIFIED
)
{
Sequence
<
sal_Int8
>
aHash
=
hashPassword
(
aPassText
,
meHash1
);
aHash
=
hashPassword
(
aHash
,
meHash2
);
#if DEBUG_TAB_PROTECTION
fprintf
(
stdout
,
"ScTableProtectionImpl::verifyPassword: hash = "
);
for
(
sal_Int32
i
=
0
;
i
<
aHash
.
getLength
();
++
i
)
printf
(
"%2.2X "
,
static_cast
<
sal_uInt8
>
(
aHash
[
i
]));
printf
(
"
\n
"
);
fprintf
(
stdout
,
"ScTableProtectionImpl::verifyPassword: hash = "
);
for
(
sal_Int32
i
=
0
;
i
<
aHash
.
getLength
();
++
i
)
printf
(
"%2.2X "
,
static_cast
<
sal_uInt8
>
(
aHash
[
i
]));
printf
(
"
\n
"
);
#endif
if
(
aHash
==
maPassHash
)
{
return
true
;
if
(
aHash
==
maPassHash
)
{
return
true
;
}
}
// tdf#115483 compat hack for ODF 1.2; for now UTF8-SHA1 passwords are only
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment