download.lst | 12 external/curl/ExternalPackage_curl.mk | 2 external/curl/ExternalProject_curl.mk | 4 external/curl/clang-cl.patch.0 | 2 external/curl/curl-7.26.0_win-proxy.patch | 20 - external/curl/curl-msvc-disable-protocols.patch.1 | 4 external/curl/curl-msvc.patch.1 | 4 external/curl/curl-nss.patch.1 | 11 external/curl/zlib.patch.0 | 20 - external/nss/asan.patch.1 | 4 external/nss/nss.patch | 6 external/poppler/StaticLibrary_poppler.mk | 7 external/poppler/UnpackedTarball_poppler.mk | 2 external/poppler/disable-freetype.patch.1 | 41 ++ external/poppler/gcc7-EntityInfo.patch.1 | 48 +++ external/poppler/poppler-config.patch.1 | 69 +++- include/sfx2/strings.hrc | 2 include/sfx2/viewfrm.hxx | 1 officecfg/registry/schema/org/openoffice/Office/Common.xcs | 16 + sdext/Executable_xpdfimport.mk | 4 sfx2/source/view/viewfrm.cxx | 40 ++ svl/source/passwordcontainer/passwordcontainer.cxx | 198 +++++++++---- svl/source/passwordcontainer/passwordcontainer.hxx | 69 +++- uui/source/iahndl-authentication.cxx | 5 24 files changed, 459 insertions(+), 132 deletions(-)
New commits: commit b62570d0126b7d16a349e74eabe0bd419974d583 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Wed Oct 26 11:07:49 2022 +0200 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Sun Oct 30 01:27:56 2022 +0200 curl: upgrade to release 7.86.0 Fixes CVE-2022-32221 which could affect libcmis, CVE-2022-42915, and 2 more CVEs that probably don't affect LO. * remove --without-ssl: On the one hand, on GNU/Linux this now results in: configure: error: --without-ssl has been set together with an explicit option to use an ssl library On the other hand, using the more obvious --without-openssl yields a link failure on Android on the nss check in configure: configure:28220: checking for SSL_VersionRangeSet in -lnss /home/cl/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: warning: liblog.so, needed by /home/cl/rpmbuild/BUILD/lo-android2/workdir/UnpackedTarball/nss/dist/out/lib/libnss3.so, not found (try using -rpath or -rpath-link) /home/cl/rpmbuild/BUILD/lo-android2/workdir/UnpackedTarball/nss/dist/out/lib/libnspr4.so: undefined reference to `__android_log_write' /home/cl/rpmbuild/BUILD/lo-android2/workdir/UnpackedTarball/nss/dist/out/lib/libnspr4.so: undefined reference to `__android_log_assert' ... so add the -llog for android in curl-nss.patch.1 Change-Id: I3931a1eec2d681c2ce0e5695039492772e9fcc81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141866 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit a76a88203d8508f38b10d9bbb94c3bba2485fcaf) diff --git a/download.lst b/download.lst index 5d27fc26bc74..92fe8a90bbab 100644 --- a/download.lst +++ b/download.lst @@ -29,8 +29,8 @@ export CPPUNIT_SHA256SUM := 3d569869d27b48860210c758c4f313082103a5e58219a7669b52 export CPPUNIT_TARBALL := cppunit-1.14.0.tar.gz export CT2N_SHA256SUM := 71b238efd2734be9800af07566daea8d6685aeed28db5eb5fa0e6453f4d85de3 export CT2N_TARBALL := 1f467e5bb703f12cbbb09d5cf67ecf4a-converttexttonumber-1-5-0.oxt -export CURL_SHA256SUM := 88b54a6d4b9a48cb4d873c7056dcba997ddd5b7be5a2d537a4acb55c20b04be6 -export CURL_TARBALL := curl-7.85.0.tar.xz +export CURL_SHA256SUM := 2d61116e5f485581f6d59865377df4463f2e788677ac43222b496d4e49fb627b +export CURL_TARBALL := curl-7.86.0.tar.xz export EBOOK_SHA256SUM := 7e8d8ff34f27831aca3bc6f9cc532c2f90d2057c778963b884ff3d1e34dfe1f9 export EBOOK_TARBALL := libe-book-0.1.3.tar.xz export EPOXY_SHA256SUM := 002958c5528321edd53440235d3c44e71b5b1e09b9177e8daf677450b6c4433d diff --git a/external/curl/ExternalProject_curl.mk b/external/curl/ExternalProject_curl.mk index 918238ce4135..32dca36c1d07 100644 --- a/external/curl/ExternalProject_curl.mk +++ b/external/curl/ExternalProject_curl.mk @@ -43,7 +43,7 @@ $(call gb_ExternalProject_get_state_target,curl,build): $(if $(filter iOS MACOSX,$(OS)),\ --with-secure-transport,\ $(if $(ENABLE_NSS),--with-nss$(if $(SYSTEM_NSS),,="$(call gb_UnpackedTarball_get_dir,nss)/dist/out") --with-nss-deprecated,--without-nss)) \ - --without-ssl --without-gnutls --without-polarssl --without-cyassl --without-axtls --without-mbedtls \ + --without-openssl --without-gnutls --without-polarssl --without-cyassl --without-axtls --without-mbedtls \ --enable-ftp --enable-http --enable-ipv6 \ --without-libidn2 --without-libpsl --without-librtmp \ --without-libssh2 --without-metalink --without-nghttp2 \ diff --git a/external/curl/curl-7.26.0_win-proxy.patch b/external/curl/curl-7.26.0_win-proxy.patch index 1c5469a35479..6fb20533e097 100644 --- a/external/curl/curl-7.26.0_win-proxy.patch +++ b/external/curl/curl-7.26.0_win-proxy.patch @@ -12,18 +12,18 @@ --- curl-7.26.0/lib/url.c +++ misc/build/curl-7.26.0/lib/url.c @@ -78,6 +78,10 @@ - bool curl_win32_idn_to_ascii(const char *in, char **out); + bool Curl_win32_idn_to_ascii(const char *in, char **out); #endif /* USE_LIBIDN2 */ +#ifdef _WIN32 +#include <WinHttp.h> +#endif + + #include "doh.h" #include "urldata.h" #include "netrc.h" - @@ -4586,6 +4590,21 @@ - } + #ifndef CURL_DISABLE_PROXY #ifndef CURL_DISABLE_HTTP +#ifdef _WIN32 @@ -72,7 +72,7 @@ + } + } + -+ if(!check_noproxy(conn->host.name, no_proxy)) { ++ if(!Curl_check_noproxy(conn->host.name, no_proxy)) { + /* Look for the http proxy setting */ + char *tok; + char *saveptr; diff --git a/external/curl/curl-nss.patch.1 b/external/curl/curl-nss.patch.1 index 016cd109c7a2..5ef25748d7eb 100644 --- a/external/curl/curl-nss.patch.1 +++ b/external/curl/curl-nss.patch.1 @@ -1,12 +1,17 @@ diff -ur curl.org/configure curl/configure --- curl.org/configure 2016-03-13 15:14:07.177000076 +0100 +++ curl/configure 2016-03-13 15:16:44.132000076 +0100 -@@ -27985,7 +27985,7 @@ +@@ -27985,7 +27985,12 @@ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Using hard-wired libraries and compilation flags for NSS." >&5 printf "%s\n" "$as_me: WARNING: Using hard-wired libraries and compilation flags for NSS." >&2;} addld="-L$OPT_NSS/lib" - addlib="-lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4" + addlib="-lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4 -lnssutil3" ++ case $host_os in ++ *android*) ++ addlib="${addlib} -llog" ++ ;; ++ esac addcflags="-I$OPT_NSS/include" version="unknown" nssprefix=$OPT_NSS commit c0856fcc7a36b919b145643bf5833b3cfc9c6b9c Author: Taichi Haradaguchi <20001...@ymail.ne.jp> AuthorDate: Thu Sep 22 20:25:53 2022 +0900 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Sun Oct 30 01:27:34 2022 +0200 curl: upgrade to release 7.85.0 Fixes CVE-2022-35252 Change-Id: I549240f6ae31ae94f925422517cd03ef2e3b5732 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140411 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit 31a8de10e8f60d79d6eb588a049567b89a48f0b1) Conflicts: external/curl/curl-msvc-zlib.patch.1 diff --git a/download.lst b/download.lst index d3f92cd991fc..5d27fc26bc74 100644 --- a/download.lst +++ b/download.lst @@ -29,8 +29,8 @@ export CPPUNIT_SHA256SUM := 3d569869d27b48860210c758c4f313082103a5e58219a7669b52 export CPPUNIT_TARBALL := cppunit-1.14.0.tar.gz export CT2N_SHA256SUM := 71b238efd2734be9800af07566daea8d6685aeed28db5eb5fa0e6453f4d85de3 export CT2N_TARBALL := 1f467e5bb703f12cbbb09d5cf67ecf4a-converttexttonumber-1-5-0.oxt -export CURL_SHA256SUM := 2cb9c2356e7263a1272fd1435ef7cdebf2cd21400ec287b068396deb705c22c4 -export CURL_TARBALL := curl-7.83.1.tar.xz +export CURL_SHA256SUM := 88b54a6d4b9a48cb4d873c7056dcba997ddd5b7be5a2d537a4acb55c20b04be6 +export CURL_TARBALL := curl-7.85.0.tar.xz export EBOOK_SHA256SUM := 7e8d8ff34f27831aca3bc6f9cc532c2f90d2057c778963b884ff3d1e34dfe1f9 export EBOOK_TARBALL := libe-book-0.1.3.tar.xz export EPOXY_SHA256SUM := 002958c5528321edd53440235d3c44e71b5b1e09b9177e8daf677450b6c4433d diff --git a/external/curl/clang-cl.patch.0 b/external/curl/clang-cl.patch.0 index 2fbb10c2a9aa..5dfb19d5ba59 100644 --- a/external/curl/clang-cl.patch.0 +++ b/external/curl/clang-cl.patch.0 @@ -1,6 +1,6 @@ --- winbuild/MakefileBuild.vc +++ winbuild/MakefileBuild.vc -@@ -60,7 +60,7 @@ +@@ -52,7 +52,7 @@ !ELSE CC_NODEBUG = $(CC) /O2 /DNDEBUG CC_DEBUG = $(CC) /Od /D_DEBUG /RTC1 /Z7 /LDd diff --git a/external/curl/curl-msvc-disable-protocols.patch.1 b/external/curl/curl-msvc-disable-protocols.patch.1 index a6d06c69b004..89c4ff576f85 100644 --- a/external/curl/curl-msvc-disable-protocols.patch.1 +++ b/external/curl/curl-msvc-disable-protocols.patch.1 @@ -2,7 +2,7 @@ disable protocols nobody needs in MSVC build --- curl/lib/config-win32.h.orig 2017-08-09 16:43:29.464000000 +0200 +++ curl/lib/config-win32.h 2017-08-09 16:47:38.549200000 +0200 -@@ -733,4 +733,20 @@ +@@ -616,4 +616,20 @@ # define ENABLE_IPV6 1 #endif @@ -25,7 +25,7 @@ disable protocols nobody needs in MSVC build #endif /* HEADER_CURL_CONFIG_WIN32_H */ --- curl/winbuild/MakefileBuild.vc.orig 2017-10-23 23:41:21.393200000 +0200 +++ curl/winbuild/MakefileBuild.vc 2017-10-23 23:34:16.028000000 +0200 -@@ -431,7 +431,7 @@ +@@ -562,7 +562,7 @@ EXE_OBJS = $(CURL_OBJS) $(CURL_DIROBJ)\curl.res diff --git a/external/curl/curl-msvc.patch.1 b/external/curl/curl-msvc.patch.1 index a5b79a8e9c49..54ad026ec8c7 100644 --- a/external/curl/curl-msvc.patch.1 +++ b/external/curl/curl-msvc.patch.1 @@ -2,7 +2,7 @@ MSVC: using SOLARINC --- curl/winbuild/MakefileBuild.vc.orig 2017-10-23 16:36:07.713550851 +0200 +++ curl/winbuild/MakefileBuild.vc 2017-10-23 16:38:19.301547594 +0200 -@@ -60,7 +60,7 @@ +@@ -52,7 +52,7 @@ !ELSE CC_NODEBUG = $(CC) /O2 /DNDEBUG CC_DEBUG = $(CC) /Od /D_DEBUG /RTC1 /Z7 /LDd @@ -11,7 +11,7 @@ MSVC: using SOLARINC !ENDIF LFLAGS = /nologo /machine:$(MACHINE) -@@ -300,11 +300,11 @@ +@@ -426,11 +426,11 @@ # CURL_XX macros are for the curl.exe command !IF "$(DEBUG)"=="yes" diff --git a/external/curl/curl-nss.patch.1 b/external/curl/curl-nss.patch.1 index d4dad7eba77e..016cd109c7a2 100644 --- a/external/curl/curl-nss.patch.1 +++ b/external/curl/curl-nss.patch.1 @@ -1,7 +1,7 @@ diff -ur curl.org/configure curl/configure --- curl.org/configure 2016-03-13 15:14:07.177000076 +0100 +++ curl/configure 2016-03-13 15:16:44.132000076 +0100 -@@ -28216,7 +28216,7 @@ +@@ -27985,7 +27985,7 @@ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Using hard-wired libraries and compilation flags for NSS." >&5 printf "%s\n" "$as_me: WARNING: Using hard-wired libraries and compilation flags for NSS." >&2;} addld="-L$OPT_NSS/lib" diff --git a/external/curl/zlib.patch.0 b/external/curl/zlib.patch.0 index e0f579f8675a..b8e242a3aaea 100644 --- a/external/curl/zlib.patch.0 +++ b/external/curl/zlib.patch.0 @@ -1,6 +1,6 @@ --- configure +++ configure -@@ -22699,7 +22699,6 @@ +@@ -22808,7 +22808,6 @@ clean_CPPFLAGS=$CPPFLAGS clean_LDFLAGS=$LDFLAGS clean_LIBS=$LIBS @@ -8,7 +8,7 @@ # Check whether --with-zlib was given. if test ${with_zlib+y} -@@ -22709,6 +22708,7 @@ +@@ -22818,6 +22818,7 @@ if test "$OPT_ZLIB" = "no" ; then @@ -16,7 +16,7 @@ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: zlib disabled" >&5 printf "%s\n" "$as_me: WARNING: zlib disabled" >&2;} else -@@ -22716,6 +22716,21 @@ +@@ -22825,6 +825,21 @@ OPT_ZLIB="" fi @@ -38,7 +38,7 @@ if test -z "$OPT_ZLIB" ; then if test -n "$PKG_CONFIG"; then -@@ -23011,6 +23026,7 @@ +@@ -23120,6 +23120,7 @@ printf "%s\n" "$as_me: found both libz and libz.h header" >&6;} curl_zlib_msg="enabled" fi @@ -48,7 +48,7 @@ if test x"$AMFIXLIB" = x1; then --- configure.ac +++ configure.ac -@@ -880,19 +880,30 @@ +@@ -1222,19 +1222,30 @@ clean_CPPFLAGS=$CPPFLAGS clean_LDFLAGS=$LDFLAGS clean_LIBS=$LIBS @@ -80,7 +80,7 @@ if test -z "$OPT_ZLIB" ; then CURL_CHECK_PKGCONFIG(zlib) -@@ -975,6 +986,7 @@ +@@ -1316,6 +1316,7 @@ AC_MSG_NOTICE([found both libz and libz.h header]) curl_zlib_msg="enabled" fi commit 8f3f45a6b61470356b7841cacab414ae7379b6e2 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Wed Sep 14 15:54:49 2022 +0200 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Sun Oct 30 01:20:23 2022 +0200 poppler: upgrade to release 22.09.0 Fixes CVE-2022-38784 Add external/poppler/disable-freetype.patch.1 to get rid of some new code that unconditionally requires freetype, to avoid building that on WNT/MACOSX. Change-Id: I854d1865286b6fb4112cdf37898cda0203c52f2e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139941 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 8fce9a0a41b1bbebd325fc9d98a79d8decd3950c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139967 Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> (cherry picked from commit bdbb450ed0ded86fb50d6b19a2cce0f11ca74b07) Conflicts: sdext/Executable_xpdfimport.mk diff --git a/download.lst b/download.lst index 42a1d4c3f40f..d3f92cd991fc 100644 --- a/download.lst +++ b/download.lst @@ -206,8 +206,8 @@ export PIXMAN_SHA256SUM := 21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3 export PIXMAN_TARBALL := e80ebae4da01e77f68744319f01d52a3-pixman-0.34.0.tar.gz export LIBPNG_SHA256SUM := 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca export LIBPNG_TARBALL := libpng-1.6.37.tar.xz -export POPPLER_SHA256SUM := 7d3493056b5b86413e5c693c2cae02c5c06cd8e618d14c2c31e2c84b67b2313e -export POPPLER_TARBALL := poppler-22.01.0.tar.xz +export POPPLER_SHA256SUM := d7a8f748211359cadb774ba3e18ecda6464b34027045c0648eb30d5852a41e2e +export POPPLER_TARBALL := poppler-22.09.0.tar.xz export POSTGRESQL_SHA256SUM := 9b81067a55edbaabc418aacef457dd8477642827499560b00615a6ea6c13f6b3 export POSTGRESQL_TARBALL := postgresql-13.5.tar.bz2 export PYTHON_SHA256SUM := c24a37c63a67f53bdd09c5f287b5cff8e8b98f857bf348c577d454d3f74db049 diff --git a/external/poppler/UnpackedTarball_poppler.mk b/external/poppler/UnpackedTarball_poppler.mk index 68fd06d9403b..0ac3c8aa69c4 100644 --- a/external/poppler/UnpackedTarball_poppler.mk +++ b/external/poppler/UnpackedTarball_poppler.mk @@ -13,6 +13,8 @@ $(eval $(call gb_UnpackedTarball_set_tarball,poppler,$(POPPLER_TARBALL),,poppler $(eval $(call gb_UnpackedTarball_add_patches,poppler,\ external/poppler/poppler-config.patch.1 \ + external/poppler/disable-freetype.patch.1 \ + external/poppler/gcc7-EntityInfo.patch.1 \ )) # vim: set noet sw=4 ts=4: diff --git a/external/poppler/disable-freetype.patch.1 b/external/poppler/disable-freetype.patch.1 new file mode 100644 index 000000000000..d59006eba979 --- /dev/null +++ b/external/poppler/disable-freetype.patch.1 @@ -0,0 +1,41 @@ +disable freetype dependent code + +--- poppler/poppler/Form.cc.orig 2022-09-14 15:46:48.588316681 +0200 ++++ poppler/poppler/Form.cc 2022-09-14 15:48:01.468274551 +0200 +@@ -46,7 +46,7 @@ + #include <cstdlib> + #include <cstring> + #include <cctype> +-#include "goo/ft_utils.h" ++//#include "goo/ft_utils.h" + #include "goo/gmem.h" + #include "goo/gfile.h" + #include "goo/GooString.h" +@@ -77,8 +77,8 @@ + #include "fofi/FoFiTrueType.h" + #include "fofi/FoFiIdentifier.h" + +-#include <ft2build.h> +-#include FT_FREETYPE_H ++//#include <ft2build.h> ++//#include FT_FREETYPE_H + + // return a newly allocated char* containing an UTF16BE string of size length + char *pdfDocEncodingToUTF16(const std::string &orig, int *length) +@@ -2730,6 +2730,8 @@ + + Form::AddFontResult Form::addFontToDefaultResources(const std::string &filepath, int faceIndex, const std::string &fontFamily, const std::string &fontStyle) + { ++ return {}; ++#if 0 + if (!GooString::endsWith(filepath, ".ttf") && !GooString::endsWith(filepath, ".ttc") && !GooString::endsWith(filepath, ".otf")) { + error(errIO, -1, "We only support embedding ttf/ttc/otf fonts for now. The font file for {0:s} {1:s} was {2:s}", fontFamily.c_str(), fontStyle.c_str(), filepath.c_str()); + return {}; +@@ -2939,6 +2941,7 @@ + } + + return { dictFontName, fontDictRef }; ++#endif + } + + std::string Form::getFallbackFontForChar(Unicode uChar, const GfxFont &fontToEmulate) const diff --git a/external/poppler/gcc7-EntityInfo.patch.1 b/external/poppler/gcc7-EntityInfo.patch.1 new file mode 100644 index 000000000000..b450bff93af9 --- /dev/null +++ b/external/poppler/gcc7-EntityInfo.patch.1 @@ -0,0 +1,48 @@ +gcc 7.3.1 says: + +workdir/UnpackedTarball/poppler/poppler/CertificateInfo.cc:42:34: error: function ‘X509CertificateInfo::EntityInfo& X509CertificateInfo::EntityInfo::operator=(X509CertificateInfo::EntityInfo&&)’ defaulted on its redeclaration with an exception-specification that differs from the implicit exception-specification ‘’ + +--- poppler/poppler/CertificateInfo.h.orig 2022-09-14 19:32:12.426351385 +0200 ++++ poppler/poppler/CertificateInfo.h 2022-09-14 19:32:18.947347812 +0200 +@@ -70,7 +70,7 @@ + ~EntityInfo(); + + EntityInfo(EntityInfo &&) noexcept; +- EntityInfo &operator=(EntityInfo &&) noexcept; ++ EntityInfo &operator=(EntityInfo &&) /*noexcept*/; + + EntityInfo(const EntityInfo &) = delete; + EntityInfo &operator=(const EntityInfo &) = delete; +--- poppler/poppler/CertificateInfo.cc.orig 2022-09-14 19:31:10.225385467 +0200 ++++ poppler/poppler/CertificateInfo.cc 2022-09-14 19:31:12.572384182 +0200 +@@ -39,7 +39,7 @@ + + X509CertificateInfo::EntityInfo::EntityInfo(X509CertificateInfo::EntityInfo &&other) noexcept = default; + +-X509CertificateInfo::EntityInfo &X509CertificateInfo::EntityInfo::operator=(X509CertificateInfo::EntityInfo &&other) noexcept = default; ++X509CertificateInfo::EntityInfo &X509CertificateInfo::EntityInfo::operator=(X509CertificateInfo::EntityInfo &&other) /*noexcept*/ = default; + + X509CertificateInfo::X509CertificateInfo() : ku_extensions(KU_NONE), cert_version(-1), is_self_signed(false) { } + +--- poppler/poppler/GfxFont.cc.orig 2022-09-14 20:24:32.569607333 +0200 ++++ poppler/poppler/GfxFont.cc 2022-09-14 20:24:52.323596186 +0200 +@@ -180,7 +180,7 @@ + + GfxFontLoc::GfxFontLoc(GfxFontLoc &&other) noexcept = default; + +-GfxFontLoc &GfxFontLoc::operator=(GfxFontLoc &&other) noexcept = default; ++GfxFontLoc &GfxFontLoc::operator=(GfxFontLoc &&other) /*noexcept*/ = default; + + void GfxFontLoc::setPath(GooString *pathA) + { +--- poppler/poppler/GfxFont.h.orig 2022-09-14 20:24:30.784608340 +0200 ++++ poppler/poppler/GfxFont.h 2022-09-14 20:25:08.850586861 +0200 +@@ -124,7 +124,7 @@ + GfxFontLoc(const GfxFontLoc &) = delete; + GfxFontLoc(GfxFontLoc &&) noexcept; + GfxFontLoc &operator=(const GfxFontLoc &) = delete; +- GfxFontLoc &operator=(GfxFontLoc &&other) noexcept; ++ GfxFontLoc &operator=(GfxFontLoc &&other) /*noexcept*/; + + // Set the 'path' string from a GooString on the heap. + // Ownership of the object is taken. diff --git a/external/poppler/poppler-config.patch.1 b/external/poppler/poppler-config.patch.1 index 2a24d4510197..455a88e2afc4 100644 --- a/external/poppler/poppler-config.patch.1 +++ b/external/poppler/poppler-config.patch.1 @@ -16,7 +16,7 @@ new file mode 100644 index 0fbd336a..451213f8 100644 --- /dev/null +++ b/config.h -@@ -0,0 +1,223 @@ +@@ -0,0 +1,220 @@ +/* config.h. Generated from config.h.cmake by cmake. */ + +/* Build against libcurl. */ @@ -105,9 +105,6 @@ index 0fbd336a..451213f8 100644 +#define HAVE_TIMEGM 1 +#endif + -+/* Define if you have the iconv() function and it works. */ -+/* #undef HAVE_ICONV */ -+ +/* Define to 1 if you have the `z' library (-lz). */ +/* #undef HAVE_LIBZ */ + @@ -176,7 +173,7 @@ index 0fbd336a..451213f8 100644 +#define PACKAGE_NAME "poppler" + +/* Define to the full name and version of this package. */ -+#define PACKAGE_STRING "poppler 21.11.0" ++#define PACKAGE_STRING "poppler 22.09.0" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "poppler" @@ -185,7 +182,7 @@ index 0fbd336a..451213f8 100644 +#define PACKAGE_URL "" + +/* Define to the version of this package. */ -+#define PACKAGE_VERSION "21.11.0" ++#define PACKAGE_VERSION "22.09.0" + +/* Poppler data dir */ +#define POPPLER_DATADIR "/usr/local/share/poppler" @@ -203,7 +200,7 @@ index 0fbd336a..451213f8 100644 +/* #undef USE_FLOAT */ + +/* Version number of package */ -+#define VERSION "21.11.0" ++#define VERSION "22.09.0" + +#if defined(__APPLE__) +#elif defined (_WIN32) @@ -229,7 +226,7 @@ index 0fbd336a..451213f8 100644 +#define popen _popen +#define pclose _pclose +#define strncasecmp _strnicmp -+// error C4005: "strcasecmp": macro redefinition #define strcasecmp _stricmp ++#define strcasecmp _stricmp +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ @@ -250,7 +247,7 @@ index 0fbd336a..451213f8 100644 +// +// poppler-config.h +// -+// Copyright 1996-2011 Glyph & Cog, LLC ++// Copyright 1996-2011, 2022 Glyph & Cog, LLC +// +//======================================================================== + @@ -284,7 +281,7 @@ index 0fbd336a..451213f8 100644 + +/* Defines the poppler version. */ +#ifndef POPPLER_VERSION -+#define POPPLER_VERSION "21.11.0" ++#define POPPLER_VERSION "22.09.0" +#endif + +/* Use single precision arithmetic in the Splash backend */ @@ -376,8 +373,8 @@ index 0fbd336a..451213f8 100644 +//------------------------------------------------------------------------ + +// copyright notice -+#define popplerCopyright "Copyright 2005-2021 The Poppler Developers - http://poppler.freedesktop.org" -+#define xpdfCopyright "Copyright 1996-2011 Glyph & Cog, LLC" ++#define popplerCopyright "Copyright 2005-2022 The Poppler Developers - http://poppler.freedesktop.org" ++#define xpdfCopyright "Copyright 1996-2011, 2022 Glyph & Cog, LLC" + +//------------------------------------------------------------------------ +// Win32 stuff @@ -436,9 +433,9 @@ index 0fbd336a..451213f8 100644 + +#include "poppler-global.h" + -+#define POPPLER_VERSION "21.11.0" -+#define POPPLER_VERSION_MAJOR 21 -+#define POPPLER_VERSION_MINOR 11 ++#define POPPLER_VERSION "22.09.0" ++#define POPPLER_VERSION_MAJOR 22 ++#define POPPLER_VERSION_MINOR 9 +#define POPPLER_VERSION_MICRO 0 + +namespace poppler diff --git a/sdext/Executable_xpdfimport.mk b/sdext/Executable_xpdfimport.mk index dde84963a1fb..fd07f7b43956 100644 --- a/sdext/Executable_xpdfimport.mk +++ b/sdext/Executable_xpdfimport.mk @@ -22,4 +22,8 @@ $(eval $(call gb_Executable_add_exception_objects,xpdfimport,\ sdext/source/pdfimport/xpdfwrapper/wrapper_gpl \ )) +$(eval $(call gb_Executable_use_system_win32_libs,xpdfimport,\ + shell32 \ +)) + # vim:set noet sw=4 ts=4: commit 5f6b59caa556c9434c1acac786abf113c6990399 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Jan 13 19:41:59 2022 +0000 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Sun Oct 30 01:18:48 2022 +0200 upgrade poppler to 22.01.0 and popppler-data to 0.4.11 Change-Id: Ibd8c28f36408a670b5853f1b266c6b8c36916a61 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128398 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit 9dbfda4cea569459e42203771754b902c1a09759) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139966 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Noel Grandin <noel.gran...@collabora.co.uk> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> (cherry picked from commit 486a1004982b4072b488e8c42a7e09afd8043c2e) diff --git a/download.lst b/download.lst index 25f20fdda295..42a1d4c3f40f 100644 --- a/download.lst +++ b/download.lst @@ -206,8 +206,8 @@ export PIXMAN_SHA256SUM := 21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3 export PIXMAN_TARBALL := e80ebae4da01e77f68744319f01d52a3-pixman-0.34.0.tar.gz export LIBPNG_SHA256SUM := 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca export LIBPNG_TARBALL := libpng-1.6.37.tar.xz -export POPPLER_SHA256SUM := 31b76b5cac0a48612fdd154c02d9eca01fd38fb8eaa77c1196840ecdeb53a584 -export POPPLER_TARBALL := poppler-21.11.0.tar.xz +export POPPLER_SHA256SUM := 7d3493056b5b86413e5c693c2cae02c5c06cd8e618d14c2c31e2c84b67b2313e +export POPPLER_TARBALL := poppler-22.01.0.tar.xz export POSTGRESQL_SHA256SUM := 9b81067a55edbaabc418aacef457dd8477642827499560b00615a6ea6c13f6b3 export POSTGRESQL_TARBALL := postgresql-13.5.tar.bz2 export PYTHON_SHA256SUM := c24a37c63a67f53bdd09c5f287b5cff8e8b98f857bf348c577d454d3f74db049 diff --git a/external/poppler/StaticLibrary_poppler.mk b/external/poppler/StaticLibrary_poppler.mk index bcb66b49299a..1f1adba6ee34 100644 --- a/external/poppler/StaticLibrary_poppler.mk +++ b/external/poppler/StaticLibrary_poppler.mk @@ -84,6 +84,8 @@ $(eval $(call gb_StaticLibrary_add_generated_exception_objects,poppler,\ UnpackedTarball/poppler/poppler/Decrypt \ UnpackedTarball/poppler/poppler/Dict \ UnpackedTarball/poppler/poppler/Error \ + UnpackedTarball/poppler/poppler/FDPDFDocBuilder \ + UnpackedTarball/poppler/poppler/FILECacheLoader \ UnpackedTarball/poppler/poppler/FileSpec \ UnpackedTarball/poppler/poppler/FontEncodingTables \ UnpackedTarball/poppler/poppler/Form \ @@ -94,6 +96,7 @@ $(eval $(call gb_StaticLibrary_add_generated_exception_objects,poppler,\ UnpackedTarball/poppler/poppler/GfxState \ UnpackedTarball/poppler/poppler/GlobalParams \ UnpackedTarball/poppler/poppler/Hints \ + UnpackedTarball/poppler/poppler/ImageEmbeddingUtils \ UnpackedTarball/poppler/poppler/JArithmeticDecoder \ UnpackedTarball/poppler/poppler/JBIG2Stream \ UnpackedTarball/poppler/poppler/JSInfo \ @@ -130,8 +133,6 @@ $(eval $(call gb_StaticLibrary_add_generated_exception_objects,poppler,\ UnpackedTarball/poppler/poppler/TextOutputDev \ UnpackedTarball/poppler/poppler/PageLabelInfo \ UnpackedTarball/poppler/poppler/SecurityHandler \ - UnpackedTarball/poppler/poppler/StdinCachedFile \ - UnpackedTarball/poppler/poppler/StdinPDFDocBuilder \ UnpackedTarball/poppler/poppler/Sound \ UnpackedTarball/poppler/poppler/ViewerPreferences \ UnpackedTarball/poppler/poppler/Movie \ commit 9a47fabd34af41d3030145fa11e0a01f06768c44 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Thu Nov 11 11:01:43 2021 +0100 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Sun Oct 30 01:18:32 2022 +0200 poppler: upgrade to release 21.11.0 The changelogs tend to mention "crash in malformed files" a lot. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125034 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 03bc0f97205593547ddf1fc8d4fb396479bcab6d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124973 Reviewed-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit 22beb8f80985ea73e2c98d14480e53da81673c67) Change-Id: Iadc1d9cc23abd09a8fff58ba0cb7a7803236a542 diff --git a/download.lst b/download.lst index d415683ec26c..25f20fdda295 100644 --- a/download.lst +++ b/download.lst @@ -206,8 +206,8 @@ export PIXMAN_SHA256SUM := 21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3 export PIXMAN_TARBALL := e80ebae4da01e77f68744319f01d52a3-pixman-0.34.0.tar.gz export LIBPNG_SHA256SUM := 505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca export LIBPNG_TARBALL := libpng-1.6.37.tar.xz -export POPPLER_SHA256SUM := 016dde34e5f868ea98a32ca99b643325a9682281500942b7113f4ec88d20e2f3 -export POPPLER_TARBALL := poppler-21.01.0.tar.xz +export POPPLER_SHA256SUM := 31b76b5cac0a48612fdd154c02d9eca01fd38fb8eaa77c1196840ecdeb53a584 +export POPPLER_TARBALL := poppler-21.11.0.tar.xz export POSTGRESQL_SHA256SUM := 9b81067a55edbaabc418aacef457dd8477642827499560b00615a6ea6c13f6b3 export POSTGRESQL_TARBALL := postgresql-13.5.tar.bz2 export PYTHON_SHA256SUM := c24a37c63a67f53bdd09c5f287b5cff8e8b98f857bf348c577d454d3f74db049 diff --git a/external/poppler/StaticLibrary_poppler.mk b/external/poppler/StaticLibrary_poppler.mk index 3cc0a95e3617..bcb66b49299a 100644 --- a/external/poppler/StaticLibrary_poppler.mk +++ b/external/poppler/StaticLibrary_poppler.mk @@ -72,6 +72,7 @@ $(eval $(call gb_StaticLibrary_add_generated_exception_objects,poppler,\ UnpackedTarball/poppler/fofi/FoFiType1C \ UnpackedTarball/poppler/fofi/FoFiIdentifier \ UnpackedTarball/poppler/poppler/Annot \ + UnpackedTarball/poppler/poppler/AnnotStampImageHelper \ UnpackedTarball/poppler/poppler/Array \ UnpackedTarball/poppler/poppler/BBoxOutputDev \ UnpackedTarball/poppler/poppler/CachedFile \ @@ -136,6 +137,7 @@ $(eval $(call gb_StaticLibrary_add_generated_exception_objects,poppler,\ UnpackedTarball/poppler/poppler/Movie \ UnpackedTarball/poppler/poppler/Rendition \ UnpackedTarball/poppler/poppler/DCTStream \ + UnpackedTarball/poppler/splash/SplashBitmap \ )) # vim: set noet sw=4 ts=4: diff --git a/external/poppler/poppler-config.patch.1 b/external/poppler/poppler-config.patch.1 index b902402ea4e7..2a24d4510197 100644 --- a/external/poppler/poppler-config.patch.1 +++ b/external/poppler/poppler-config.patch.1 @@ -16,7 +16,7 @@ new file mode 100644 index 0fbd336a..451213f8 100644 --- /dev/null +++ b/config.h -@@ -0,0 +1,221 @@ +@@ -0,0 +1,223 @@ +/* config.h. Generated from config.h.cmake by cmake. */ + +/* Build against libcurl. */ @@ -176,7 +176,7 @@ index 0fbd336a..451213f8 100644 +#define PACKAGE_NAME "poppler" + +/* Define to the full name and version of this package. */ -+#define PACKAGE_STRING "poppler 21.01.0" ++#define PACKAGE_STRING "poppler 21.11.0" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "poppler" @@ -185,7 +185,7 @@ index 0fbd336a..451213f8 100644 +#define PACKAGE_URL "" + +/* Define to the version of this package. */ -+#define PACKAGE_VERSION "21.01.0" ++#define PACKAGE_VERSION "21.11.0" + +/* Poppler data dir */ +#define POPPLER_DATADIR "/usr/local/share/poppler" @@ -203,7 +203,7 @@ index 0fbd336a..451213f8 100644 +/* #undef USE_FLOAT */ + +/* Version number of package */ -+#define VERSION "21.01.0" ++#define VERSION "21.11.0" + +#if defined(__APPLE__) +#elif defined (_WIN32) @@ -228,6 +228,8 @@ index 0fbd336a..451213f8 100644 +#if defined(_MSC_VER) || defined(__BORLANDC__) +#define popen _popen +#define pclose _pclose ++#define strncasecmp _strnicmp ++// error C4005: "strcasecmp": macro redefinition #define strcasecmp _stricmp +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ @@ -243,7 +245,7 @@ new file mode 100644 index 0fbd336a..451213f8 100644 --- /dev/null +++ b/poppler/poppler-config.h -@@ -0,0 +1,166 @@ +@@ -0,0 +1,161 @@ +//================================================= -*- mode: c++ -*- ==== +// +// poppler-config.h @@ -282,7 +284,7 @@ index 0fbd336a..451213f8 100644 + +/* Defines the poppler version. */ +#ifndef POPPLER_VERSION -+#define POPPLER_VERSION "21.01.0" ++#define POPPLER_VERSION "21.11.0" +#endif + +/* Use single precision arithmetic in the Splash backend */ @@ -369,11 +371,6 @@ index 0fbd336a..451213f8 100644 +/* #undef USE_BOOST_HEADERS */ +#endif + -+/* Is splash backend available */ -+#ifndef HAVE_SPLASH -+/* #undef HAVE_SPLASH */ -+#endif -+ +//------------------------------------------------------------------------ +// version +//------------------------------------------------------------------------ @@ -439,9 +436,9 @@ index 0fbd336a..451213f8 100644 + +#include "poppler-global.h" + -+#define POPPLER_VERSION "21.01.0" ++#define POPPLER_VERSION "21.11.0" +#define POPPLER_VERSION_MAJOR 21 -+#define POPPLER_VERSION_MINOR 1 ++#define POPPLER_VERSION_MINOR 11 +#define POPPLER_VERSION_MICRO 0 + +namespace poppler @@ -455,3 +452,38 @@ index 0fbd336a..451213f8 100644 +} + +#endif +diff --git a/poppler_private_export.h b/poppler_private_export.h +new file mode 100644 +index 0fbd336a..451213f8 100644 +--- /dev/null ++++ b/poppler_private_export.h +@@ -0,0 +1,11 @@ ++ ++#ifndef POPPLER_PRIVATE_EXPORT_H ++#define POPPLER_PRIVATE_EXPORT_H ++ ++# define POPPLER_PRIVATE_EXPORT ++# define POPPLER_PRIVATE_NO_EXPORT ++# define POPPLER_PRIVATE_DEPRECATED ++# define POPPLER_PRIVATE_DEPRECATED_EXPORT ++# define POPPLER_PRIVATE_DEPRECATED_NO_EXPORT ++ ++#endif /* POPPLER_PRIVATE_EXPORT_H */ + +diff --git a/cpp/poppler_cpp_export.h b/cpp/poppler_cpp_export.h +new file mode 100644 +index 0fbd336a..451213f8 100644 +--- /dev/null ++++ b/cpp/poppler_cpp_export.h +@@ -0,0 +1,11 @@ ++ ++#ifndef POPPLER_CPP_EXPORT_H ++#define POPPLER_CPP_EXPORT_H ++ ++# define POPPLER_CPP_EXPORT ++# define POPPLER_CPP_NO_EXPORT ++# define POPPLER_CPP_DEPRECATED ++# define POPPLER_CPP_DEPRECATED_EXPORT ++# define POPPLER_CPP_DEPRECATED_NO_EXPORT ++ ++#endif /* POPPLER_CPP_EXPORT_H */ commit 2ca034d76b4920b79ec20fcf39e0f973db84e341 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Wed Jun 1 12:14:44 2022 +0200 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Sun Oct 30 01:09:32 2022 +0200 nss: upgrade to release 3.79 Fixes CVE-2022-1097 and moz#1767590 "memory safety violations" Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135234 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135248 Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> (cherry picked from commit bb5216e345c42be440bce60b127af517c036c8ef) Change-Id: I6895f066ad943402231b616dae0d7ed6f5678b5e Conflicts: download.lst diff --git a/download.lst b/download.lst index 9c214b6f0cf2..d415683ec26c 100644 --- a/download.lst +++ b/download.lst @@ -181,8 +181,8 @@ export MYTHES_SHA256SUM := 1e81f395d8c851c3e4e75b568e20fa2fa549354e75ab397f9de4b export MYTHES_TARBALL := a8c2c5b8f09e7ede322d5c602ff6a4b6-mythes-1.2.4.tar.gz export NEON_SHA256SUM := db0bd8cdec329b48f53a6f00199c92d5ba40b0f015b153718d1b15d3d967fbca export NEON_TARBALL := neon-0.30.2.tar.gz -export NSS_SHA256SUM := 07a9e5b70f121a62706140d4cacc3006d3efb869da40f3a2bf7a65d37847f4d9 -export NSS_TARBALL := nss-3.73-with-nspr-4.32.tar.gz +export NSS_SHA256SUM := 5369ed274a19f480ec94e1faef04da63e3cbac1a82e15bb1751e58b2f274b835 +export NSS_TARBALL := nss-3.79-with-nspr-4.34.tar.gz export ODFGEN_SHA256SUM := 2c7b21892f84a4c67546f84611eccdad6259875c971e98ddb027da66ea0ac9c2 export ODFGEN_VERSION_MICRO := 6 export ODFGEN_TARBALL := libodfgen-0.1.$(ODFGEN_VERSION_MICRO).tar.bz2 diff --git a/external/nss/asan.patch.1 b/external/nss/asan.patch.1 index 7dfd6ed4e782..ce584a34a3b5 100644 --- a/external/nss/asan.patch.1 +++ b/external/nss/asan.patch.1 @@ -7,6 +7,6 @@ diff -ur nss.org/nss/coreconf/Linux.mk nss/nss/coreconf/Linux.mk # against the libsanitizer runtime built into the main executable. -ZDEFS_FLAG = -Wl,-z,defs +ZDEFS_FLAG = - DSO_LDOPTS += $(if $(findstring 2.11.90.0.8,$(shell ld -v)),,$(ZDEFS_FLAG)) $(if $(filter-out $(OS),ANDROID),-Wl$(COMMA)-z$(COMMA)origin '-Wl$(COMMA)-rpath$(COMMA)$$ORIGIN') - LDFLAGS += $(ARCHFLAG) -z noexecstack + DSO_LDOPTS += $(if $(findstring 2.11.90.0.8,$(shell $(LD) -v)),,$(ZDEFS_FLAG)) $(if $(filter-out $(OS),ANDROID),-Wl$(COMMA)-z$(COMMA)origin '-Wl$(COMMA)-rpath$(COMMA)$$ORIGIN') + LDFLAGS += $(ARCHFLAG) -z noexecstack diff --git a/external/nss/nss.patch b/external/nss/nss.patch index d9aaee5199bb..66fbe37dc5ed 100644 --- a/external/nss/nss.patch +++ b/external/nss/nss.patch @@ -87,9 +87,9 @@ # Also, -z defs conflicts with Address Sanitizer, which emits relocations # against the libsanitizer runtime built into the main executable. ZDEFS_FLAG = -Wl,-z,defs --DSO_LDOPTS += $(if $(findstring 2.11.90.0.8,$(shell ld -v)),,$(ZDEFS_FLAG)) -+DSO_LDOPTS += $(if $(findstring 2.11.90.0.8,$(shell ld -v)),,$(ZDEFS_FLAG)) $(if $(filter-out $(OS),ANDROID),-Wl$(COMMA)-z$(COMMA)origin '-Wl$(COMMA)-rpath$(COMMA)$$ORIGIN') - LDFLAGS += $(ARCHFLAG) -z noexecstack +-DSO_LDOPTS += $(if $(findstring 2.11.90.0.8,$(shell $(LD) -v)),,$(ZDEFS_FLAG)) ++DSO_LDOPTS += $(if $(findstring 2.11.90.0.8,$(shell $(LD) -v)),,$(ZDEFS_FLAG)) $(if $(filter-out $(OS),ANDROID),-Wl$(COMMA)-z$(COMMA)origin '-Wl$(COMMA)-rpath$(COMMA)$$ORIGIN') + LDFLAGS += $(ARCHFLAG) -z noexecstack # On Maemo, we need to use the -rpath-link flag for even the standard system @@ -177,8 +177,13 @@ commit 09ff8243be66c6421340a5bef693c9e0b99bd4d2 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Thu May 12 11:43:59 2022 +0200 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Sun Oct 30 01:06:52 2022 +0200 curl: upgrade to release 7.83.1 Fixes CVE-2022-27774 CVE-2022-27775 CVE-2022-27776 CVE-2022-27781 plus 6 more CVEs that shouldn't affect LO. Remove obsolete configure-eval-fix.patch.0. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134225 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 58a3bf5199818e30ef4207213f29692d81b519c6) upgrade to curl-7.81.0 Change-Id: I0a34239bfb16bf19e25bf374c7f36c4cdf1776c1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128783 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit 40a84af1bdd7b3c414a8a78ca32b0951c03f9976) Change-Id: Ifbd7ff5acf390df1d95d6b8be0dc7751e4753bbe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134246 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit f668663d63d5b0f37d4727b54585c3b67ab92162) diff --git a/download.lst b/download.lst index b997b026fbe4..9c214b6f0cf2 100644 --- a/download.lst +++ b/download.lst @@ -29,8 +29,8 @@ export CPPUNIT_SHA256SUM := 3d569869d27b48860210c758c4f313082103a5e58219a7669b52 export CPPUNIT_TARBALL := cppunit-1.14.0.tar.gz export CT2N_SHA256SUM := 71b238efd2734be9800af07566daea8d6685aeed28db5eb5fa0e6453f4d85de3 export CT2N_TARBALL := 1f467e5bb703f12cbbb09d5cf67ecf4a-converttexttonumber-1-5-0.oxt -export CURL_SHA256SUM := 0606f74b1182ab732a17c11613cbbaf7084f2e6cca432642d0e3ad7c224c3689 -export CURL_TARBALL := curl-7.79.1.tar.xz +export CURL_SHA256SUM := 2cb9c2356e7263a1272fd1435ef7cdebf2cd21400ec287b068396deb705c22c4 +export CURL_TARBALL := curl-7.83.1.tar.xz export EBOOK_SHA256SUM := 7e8d8ff34f27831aca3bc6f9cc532c2f90d2057c778963b884ff3d1e34dfe1f9 export EBOOK_TARBALL := libe-book-0.1.3.tar.xz export EPOXY_SHA256SUM := 002958c5528321edd53440235d3c44e71b5b1e09b9177e8daf677450b6c4433d diff --git a/external/curl/ExternalPackage_curl.mk b/external/curl/ExternalPackage_curl.mk index 1fb360c85ca9..3308074b363c 100644 --- a/external/curl/ExternalPackage_curl.mk +++ b/external/curl/ExternalPackage_curl.mk @@ -20,7 +20,7 @@ $(eval $(call gb_ExternalPackage_add_file,curl,$(LIBO_LIB_FOLDER)/libcurl.4.dyli else ifeq ($(OS),AIX) $(eval $(call gb_ExternalPackage_add_file,curl,$(LIBO_LIB_FOLDER)/libcurl.so,lib/.libs/libcurl.so.4)) else -$(eval $(call gb_ExternalPackage_add_file,curl,$(LIBO_LIB_FOLDER)/libcurl.so.4,lib/.libs/libcurl.so.4.7.0)) +$(eval $(call gb_ExternalPackage_add_file,curl,$(LIBO_LIB_FOLDER)/libcurl.so.4,lib/.libs/libcurl.so.4.8.0)) endif endif # $(DISABLE_DYNLOADING) diff --git a/external/curl/ExternalProject_curl.mk b/external/curl/ExternalProject_curl.mk index 06cc96c2e8de..918238ce4135 100644 --- a/external/curl/ExternalProject_curl.mk +++ b/external/curl/ExternalProject_curl.mk @@ -42,7 +42,7 @@ $(call gb_ExternalProject_get_state_target,curl,build): ./configure \ $(if $(filter iOS MACOSX,$(OS)),\ --with-secure-transport,\ - $(if $(ENABLE_NSS),--with-nss$(if $(SYSTEM_NSS),,="$(call gb_UnpackedTarball_get_dir,nss)/dist/out"),--without-nss)) \ + $(if $(ENABLE_NSS),--with-nss$(if $(SYSTEM_NSS),,="$(call gb_UnpackedTarball_get_dir,nss)/dist/out") --with-nss-deprecated,--without-nss)) \ --without-ssl --without-gnutls --without-polarssl --without-cyassl --without-axtls --without-mbedtls \ --enable-ftp --enable-http --enable-ipv6 \ --without-libidn2 --without-libpsl --without-librtmp \ diff --git a/external/curl/curl-7.26.0_win-proxy.patch b/external/curl/curl-7.26.0_win-proxy.patch index 46cdcc739d80..1c5469a35479 100644 --- a/external/curl/curl-7.26.0_win-proxy.patch +++ b/external/curl/curl-7.26.0_win-proxy.patch @@ -31,7 +31,7 @@ +{ + int bufSize; + char *out = NULL; -+ if(wStr != NULL) { ++ if(wStr) { + bufSize = WideCharToMultiByte( + CP_ACP, 0, wStr, -1, NULL, 0, NULL, NULL); + out = (char *)malloc(bufSize * sizeof(char)); @@ -63,10 +63,10 @@ + ieNoProxy = wstrToCstr(ieProxyConfig->lpszProxyBypass); + + /* Convert the ieNoProxy into a proper no_proxy value */ -+ if(NULL != ieNoProxy) { ++ if(ieNoProxy) { + no_proxy = strdup(ieNoProxy); + pos = strpbrk(no_proxy, "; "); -+ while(NULL != pos) { ++ while(pos) { + no_proxy[pos-no_proxy] = ','; + pos = strpbrk(no_proxy, "; "); + } @@ -77,9 +77,9 @@ + char *tok; + char *saveptr; + -+ if(NULL != ieProxy) { ++ if(ieProxy) { + tok = strtok_s(ieProxy, ";", &saveptr); -+ if(strchr(tok, '=') == NULL) { ++ if(!strchr(tok, '=')) { + proxy = strdup(ieProxy); + } + else { @@ -90,7 +90,7 @@ + } + tok = strtok_s(NULL, ";", &saveptr); + } -+ while(NULL != tok); ++ while(tok); + } + } + } commit 9260382f464437a99cbfcb3b294bf59be963511b Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Oct 20 10:41:42 2021 +0100 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Sun Oct 30 01:06:43 2022 +0200 upgrade curl to 7.79.1 includes: CVE-2021-22945: clear the leftovers pointer when sending succeeds CVE-2021-22946: do not ignore --ssl-reqd CVE-2021-22947: reject STARTTLS server response pipelining Change-Id: I0047bdaa7e6e3aed1317eb014d2051a4d5ac5964 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123883 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit a08d1dc4ee904428ef6f78208cc2508d3fc3717b) diff --git a/download.lst b/download.lst index 20c413586287..b997b026fbe4 100644 --- a/download.lst +++ b/download.lst @@ -29,8 +29,8 @@ export CPPUNIT_SHA256SUM := 3d569869d27b48860210c758c4f313082103a5e58219a7669b52 export CPPUNIT_TARBALL := cppunit-1.14.0.tar.gz export CT2N_SHA256SUM := 71b238efd2734be9800af07566daea8d6685aeed28db5eb5fa0e6453f4d85de3 export CT2N_TARBALL := 1f467e5bb703f12cbbb09d5cf67ecf4a-converttexttonumber-1-5-0.oxt -export CURL_SHA256SUM := be42766d5664a739c3974ee3dfbbcbe978a4ccb1fe628bb1d9b59ac79e445fb5 -export CURL_TARBALL := curl-7.78.0.tar.xz +export CURL_SHA256SUM := 0606f74b1182ab732a17c11613cbbaf7084f2e6cca432642d0e3ad7c224c3689 +export CURL_TARBALL := curl-7.79.1.tar.xz export EBOOK_SHA256SUM := 7e8d8ff34f27831aca3bc6f9cc532c2f90d2057c778963b884ff3d1e34dfe1f9 export EBOOK_TARBALL := libe-book-0.1.3.tar.xz export EPOXY_SHA256SUM := 002958c5528321edd53440235d3c44e71b5b1e09b9177e8daf677450b6c4433d diff --git a/external/curl/curl-nss.patch.1 b/external/curl/curl-nss.patch.1 index 69fde5f7f236..d4dad7eba77e 100644 --- a/external/curl/curl-nss.patch.1 +++ b/external/curl/curl-nss.patch.1 @@ -1,9 +1,9 @@ diff -ur curl.org/configure curl/configure --- curl.org/configure 2016-03-13 15:14:07.177000076 +0100 +++ curl/configure 2016-03-13 15:16:44.132000076 +0100 -@@ -24009,7 +24009,7 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Using hard-wired libraries and compilation flags for NSS." >&5 - $as_echo "$as_me: WARNING: Using hard-wired libraries and compilation flags for NSS." >&2;} +@@ -28216,7 +28216,7 @@ + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Using hard-wired libraries and compilation flags for NSS." >&5 + printf "%s\n" "$as_me: WARNING: Using hard-wired libraries and compilation flags for NSS." >&2;} addld="-L$OPT_NSS/lib" - addlib="-lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4" + addlib="-lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4 -lnssutil3" diff --git a/external/curl/zlib.patch.0 b/external/curl/zlib.patch.0 index f4a0ad4b152f..e0f579f8675a 100644 --- a/external/curl/zlib.patch.0 +++ b/external/curl/zlib.patch.0 @@ -1,22 +1,22 @@ --- configure +++ configure -@@ -20709,7 +20709,6 @@ +@@ -22699,7 +22699,6 @@ clean_CPPFLAGS=$CPPFLAGS clean_LDFLAGS=$LDFLAGS clean_LIBS=$LIBS -ZLIB_LIBS="" # Check whether --with-zlib was given. - if test "${with_zlib+set}" = set; then : -@@ -20718,6 +20719,7 @@ + if test ${with_zlib+y} +@@ -22709,6 +22708,7 @@ if test "$OPT_ZLIB" = "no" ; then + ZLIB_LIBS="" - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: zlib disabled" >&5 - $as_echo "$as_me: WARNING: zlib disabled" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: zlib disabled" >&5 + printf "%s\n" "$as_me: WARNING: zlib disabled" >&2;} else -@@ -20725,6 +20725,21 @@ +@@ -22716,6 +22716,21 @@ OPT_ZLIB="" fi @@ -38,8 +38,8 @@ if test -z "$OPT_ZLIB" ; then if test -n "$PKG_CONFIG"; then -@@ -21005,6 +21020,7 @@ - $as_echo "$as_me: found both libz and libz.h header" >&6;} +@@ -23011,6 +23026,7 @@ + printf "%s\n" "$as_me: found both libz and libz.h header" >&6;} curl_zlib_msg="enabled" fi + fi commit 63bf9668f38ee0504770b5ef8668a58d568b498d Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Mar 23 13:03:30 2022 +0000 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Sun Oct 30 01:01:38 2022 +0200 add infobar to prompt to refresh to replace old format Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131976 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit bbd196ff82bda9f66b4ba32a412f10cefe6da60e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132307 Reviewed-by: Sophie Gautier <so...@libreoffice.org> Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> (cherry picked from commit c5d01b11db3c83cb4a89d3b388d78e20dd3990b5) (cherry picked from commit df05d27336927373bf83664a90156fbe505fc546) Change-Id: Id99cbf2b50a4ebf289dae6fc67e22e20afcda35b diff --git a/include/sfx2/strings.hrc b/include/sfx2/strings.hrc index cdf3e440aea9..c210c95c1f62 100644 --- a/include/sfx2/strings.hrc +++ b/include/sfx2/strings.hrc @@ -267,6 +267,8 @@ #define STR_SIGNATURE_NOTVALIDATED_PARTIAL_OK NC_("STR_SIGNATURE_NOTVALIDATED_PARTIAL_OK", "The certificate could not be validated and the document is only partially signed.") #define STR_SIGNATURE_OK NC_("STR_SIGNATURE_OK", "This document is digitally signed and the signature is valid.") #define STR_SIGNATURE_SHOW NC_("STR_SIGNATURE_SHOW", "Show Signatures") +#define STR_REFRESH_MASTER_PASSWORD NC_("STR_REFRESH_MASTER_PASSWORD", "The master password is stored in an outdated format, you should refresh it") +#define STR_REFRESH_PASSWORD NC_("STR_REFRESH_PASSWORD", "Refresh Password") #define STR_CLOSE_PANE NC_("STR_CLOSE_PANE", "Close Pane") #define STR_SFX_DOCK NC_("STR_SFX_DOCK", "Dock") diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx index 502f1fe4480d..534a5707a69d 100644 --- a/include/sfx2/viewfrm.hxx +++ b/include/sfx2/viewfrm.hxx @@ -61,6 +61,7 @@ protected: DECL_LINK(WhatsNewHandler, Button*, void); DECL_LINK(SwitchReadOnlyHandler, Button*, void); DECL_LINK(SignDocumentHandler, Button*, void); + DECL_DLLPRIVATE_LINK(RefreshMasterPasswordHdl, Button*, void); SAL_DLLPRIVATE void KillDispatcher_Impl(); virtual ~SfxViewFrame() override; diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index f879bc1df21f..04b8f5f3c1ad 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/frame/XLoadable.hpp> #include <com/sun/star/frame/XLayoutManager.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> +#include <com/sun/star/task/PasswordContainer.hpp> #include <officecfg/Office/Common.hxx> #include <officecfg/Setup.hxx> #include <toolkit/helper/vclunohelper.hxx> @@ -1321,6 +1322,24 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) batch->commit(); } + if (officecfg::Office::Common::Passwords::HasMaster::get() && + officecfg::Office::Common::Passwords::StorageVersion::get() == 0) + { + // master password stored in deprecated format + VclPtr<SfxInfoBarWindow> pOldMasterPasswordInfoBar = + AppendInfoBar("oldmasterpassword", + SfxResId(STR_REFRESH_MASTER_PASSWORD), InfoBarType::Danger); + if (pOldMasterPasswordInfoBar) + { + VclPtrInstance<PushButton> const xBtn(&GetWindow()); + xBtn->SetText(SfxResId(STR_REFRESH_PASSWORD)); + xBtn->SetSizePixel(xBtn->GetOptimalSize()); + xBtn->SetClickHdl(LINK(this, + SfxViewFrame, RefreshMasterPasswordHdl)); + pOldMasterPasswordInfoBar->addButton(xBtn); + } + } + // read-only infobar if necessary const SfxViewShell *pVSh; const SfxShell *pFSh; @@ -1475,6 +1494,27 @@ IMPL_LINK_NOARG(SfxViewFrame, SignDocumentHandler, Button*, void) GetDispatcher()->Execute(SID_SIGNATURE); } +IMPL_LINK_NOARG(SfxViewFrame, RefreshMasterPasswordHdl, Button*, void) +{ + bool bChanged = false; + try + { + Reference< task::XPasswordContainer2 > xMasterPasswd( + task::PasswordContainer::create(comphelper::getProcessComponentContext())); + + css::uno::Reference<css::frame::XFrame> xFrame = GetFrame().GetFrameInterface(); + css::uno::Reference<css::awt::XWindow> xContainerWindow = xFrame->getContainerWindow(); + + uno::Reference<task::XInteractionHandler> xTmpHandler(task::InteractionHandler::createWithParent(comphelper::getProcessComponentContext(), + xContainerWindow)); + bChanged = xMasterPasswd->changeMasterPassword(xTmpHandler); + } + catch (const Exception&) + {} + if (bChanged) + RemoveInfoBar(u"oldmasterpassword"); +} + void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh ) { m_pImpl->bResizeInToOut = true; commit a21ee6d71dd550e8da955ed453540710f21f0b0c Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Mar 22 17:22:22 2022 +0000 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Sun Oct 30 00:59:37 2022 +0200 add Initialization Vectors to password storage old ones default to the current all zero case and continue to work as before Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131974 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 192fa1e3bfc6269f2ebb91716471485a56074aea) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132306 Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> (cherry picked from commit ab77587ec300f5c30084471000663c46ddf25dad) (cherry picked from commit 713296ecd30bab02d41fcd23f19afed28d916701) Change-Id: I6fe3b02fafcce1b5e7133e77e76a5118177d77af Conflicts: svl/source/passwordcontainer/passwordcontainer.hxx diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index c1890efc4599..eec52ae15168 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -27,6 +27,11 @@ <info> <desc>Contains a container for passwords.</desc> </info> + <prop oor:name="InitializationVector" oor:type="xs:string"> + <info> + <desc>Contains an initialization vector for the password encryption.</desc> + </info> + </prop> <prop oor:name="Password" oor:type="xs:string" oor:localized="false"> <info> <desc>Contains a password encoded with the master password.</desc> @@ -923,6 +928,11 @@ </info> <value>false</value> </prop> + <prop oor:name="MasterInitializationVector" oor:type="xs:string"> + <info> + <desc>Contains an initialization vector for the master password encryption.</desc> + </info> + </prop> <prop oor:name="Master" oor:type="xs:string" oor:nillable="false"> <info> <desc>Contains the master password encrypted by itself.</desc> diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx index 75aa904474c8..3d85a3f1501a 100644 --- a/svl/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -185,15 +185,18 @@ PassMap StorageItem::getInfo() Sequence< OUString > aNodeNames = ConfigItem::GetNodeNames( "Store" ); sal_Int32 aNodeCount = aNodeNames.getLength(); - Sequence< OUString > aPropNames( aNodeCount ); + Sequence< OUString > aPropNames( aNodeCount * 2); std::transform(aNodeNames.begin(), aNodeNames.end(), aPropNames.begin(), [](const OUString& rName) -> OUString { return "Store/Passwordstorage['" + rName + "']/Password"; }); + std::transform(aNodeNames.begin(), aNodeNames.end(), aPropNames.getArray() + aNodeCount, + [](const OUString& rName) -> OUString { + return "Store/Passwordstorage['" + rName + "']/InitializationVector"; }); Sequence< Any > aPropertyValues = ConfigItem::GetProperties( aPropNames ); - if( aPropertyValues.getLength() != aNodeCount ) + if( aPropertyValues.getLength() != aNodeCount * 2) { OSL_FAIL( "Problems during reading" ); return aResult; @@ -209,14 +212,16 @@ PassMap StorageItem::getInfo() OUString aName = aUrlUsr[1]; OUString aEPasswd; + OUString aIV; aPropertyValues[aNodeInd] >>= aEPasswd; + aPropertyValues[aNodeInd + aNodeCount] >>= aIV; PassMap::iterator aIter = aResult.find( aUrl ); if( aIter != aResult.end() ) - aIter->second.emplace_back( aName, aEPasswd ); + aIter->second.emplace_back( aName, aEPasswd, aIV ); else { - NamePassRecord aNewRecord( aName, aEPasswd ); + NamePassRecord aNewRecord( aName, aEPasswd, aIV ); std::vector< NamePassRecord > listToAdd( 1, aNewRecord ); aResult.insert( PairUrlRecord( aUrl, listToAdd ) ); @@ -280,17 +285,19 @@ sal_Int32 StorageItem::getStorageVersion() return nResult; } -bool StorageItem::getEncodedMP( OUString& aResult ) +bool StorageItem::getEncodedMP( OUString& aResult, OUString& aResultIV ) { if( hasEncoded ) { aResult = mEncoded; + aResultIV = mEncodedIV; return true; } - Sequence< OUString > aNodeNames( 2 ); + Sequence< OUString > aNodeNames( 3 ); aNodeNames[0] = "HasMaster"; aNodeNames[1] = "Master"; + aNodeNames[2] = "MasterInitializationVector"; Sequence< Any > aPropertyValues = ConfigItem::GetProperties( aNodeNames ); @@ -302,32 +309,37 @@ bool StorageItem::getEncodedMP( OUString& aResult ) aPropertyValues[0] >>= hasEncoded; aPropertyValues[1] >>= mEncoded; + aPropertyValues[2] >>= mEncodedIV; aResult = mEncoded; + aResultIV = mEncodedIV; return hasEncoded; } -void StorageItem::setEncodedMP( const OUString& aEncoded, bool bAcceptEmpty ) +void StorageItem::setEncodedMP( const OUString& aEncoded, const OUString& aEncodedIV, bool bAcceptEmpty ) { - Sequence< OUString > sendNames(3); - Sequence< uno::Any > sendVals(3); + Sequence< OUString > sendNames(4); + Sequence< uno::Any > sendVals(4); sendNames[0] = "HasMaster"; sendNames[1] = "Master"; - sendNames[2] = "StorageVersion"; + sendNames[2] = "MasterInitializationVector"; + sendNames[3] = "StorageVersion"; bool bHasMaster = ( !aEncoded.isEmpty() || bAcceptEmpty ); sendVals[0] <<= bHasMaster; sendVals[1] <<= aEncoded; - sendVals[2] <<= nCurrentStorageVersion; + sendVals[2] <<= aEncodedIV; + sendVals[3] <<= nCurrentStorageVersion; ConfigItem::SetModified(); ConfigItem::PutProperties( sendNames, sendVals ); hasEncoded = bHasMaster; mEncoded = aEncoded; + mEncodedIV = aEncodedIV; } @@ -363,11 +375,13 @@ void StorageItem::update( const OUString& aURL, const NamePassRecord& aRecord ) forIndex.push_back( aURL ); forIndex.push_back( aRecord.GetUserName() ); - Sequence< beans::PropertyValue > sendSeq(1); + Sequence< beans::PropertyValue > sendSeq(2); - sendSeq[0].Name = "Store/Passwordstorage['" + createIndex( forIndex ) + "']/Password"; + sendSeq[0].Name = "Store/Passwordstorage['" + createIndex( { aURL, aRecord.GetUserName() } ) + "']/InitializationVector"; + sendSeq[0].Value <<= aRecord.GetPersistentIV(); - sendSeq[0].Value <<= aRecord.GetPersPasswords(); + sendSeq[1].Name = "Store/Passwordstorage['" + createIndex( forIndex ) + "']/Password"; + sendSeq[1].Value <<= aRecord.GetPersPasswords(); ConfigItem::SetModified(); ConfigItem::SetSetProperties( "Store", sendSeq ); @@ -428,7 +442,7 @@ void SAL_CALL PasswordContainer::disposing( const EventObject& ) } } -std::vector< OUString > PasswordContainer::DecodePasswords( const OUString& aLine, const OUString& aMasterPasswd, css::task::PasswordRequestMode mode ) +std::vector< OUString > PasswordContainer::DecodePasswords( const OUString& aLine, const OUString& aIV, const OUString& aMasterPasswd, css::task::PasswordRequestMode mode ) { if( !aMasterPasswd.isEmpty() ) { @@ -443,9 +457,16 @@ std::vector< OUString > PasswordContainer::DecodePasswords( const OUString& aLin for( int ind = 0; ind < RTL_DIGEST_LENGTH_MD5; ind++ ) code[ ind ] = static_cast<char>(aMasterPasswd.copy( ind*2, 2 ).toUInt32(16)); + unsigned char iv[RTL_DIGEST_LENGTH_MD5] = {0}; + if (!aIV.isEmpty()) + { + for( int ind = 0; ind < RTL_DIGEST_LENGTH_MD5; ind++ ) + iv[ ind ] = static_cast<char>(aIV.copy( ind*2, 2 ).toUInt32(16)); + } + rtlCipherError result = rtl_cipher_init ( aDecoder, rtl_Cipher_DirectionDecode, - code, RTL_DIGEST_LENGTH_MD5, nullptr, 0 ); + code, RTL_DIGEST_LENGTH_MD5, iv, RTL_DIGEST_LENGTH_MD5 ); if( result == rtl_Cipher_E_None ) { @@ -478,7 +499,7 @@ std::vector< OUString > PasswordContainer::DecodePasswords( const OUString& aLin "Can't decode!", css::uno::Reference<css::uno::XInterface>(), mode); } -OUString PasswordContainer::EncodePasswords(const std::vector< OUString >& lines, const OUString& aMasterPasswd ) +OUString PasswordContainer::EncodePasswords(const std::vector< OUString >& lines, const OUString& aIV, const OUString& aMasterPasswd) { if( !aMasterPasswd.isEmpty() ) { @@ -495,9 +516,16 @@ OUString PasswordContainer::EncodePasswords(const std::vector< OUString >& lines for( int ind = 0; ind < RTL_DIGEST_LENGTH_MD5; ind++ ) code[ ind ] = static_cast<char>(aMasterPasswd.copy( ind*2, 2 ).toUInt32(16)); + unsigned char iv[RTL_DIGEST_LENGTH_MD5] = {0}; + if (!aIV.isEmpty()) + { + for( int ind = 0; ind < RTL_DIGEST_LENGTH_MD5; ind++ ) + iv[ ind ] = static_cast<char>(aIV.copy( ind*2, 2 ).toUInt32(16)); + } + rtlCipherError result = rtl_cipher_init ( aEncoder, rtl_Cipher_DirectionEncode, - code, RTL_DIGEST_LENGTH_MD5, nullptr, 0 ); + code, RTL_DIGEST_LENGTH_MD5, iv, RTL_DIGEST_LENGTH_MD5 ); if( result == rtl_Cipher_E_None ) { @@ -565,7 +593,7 @@ void PasswordContainer::UpdateVector( const OUString& aURL, std::vector< NamePas if( aRecord.HasPasswords( PERSISTENT_RECORD ) ) { - aNPIter.SetPersPasswords( aRecord.GetPersPasswords() ); + aNPIter.SetPersPasswords( aRecord.GetPersPasswords(), aRecord.GetPersistentIV() ); if( writeFile ) { @@ -598,7 +626,8 @@ UserRecord PasswordContainer::CopyToUserRecord( const NamePassRecord& aRecord, b { try { - ::std::vector< OUString > aDecodedPasswords = DecodePasswords( aRecord.GetPersPasswords(), GetMasterPassword( aHandler ), css::task::PasswordRequestMode_PASSWORD_ENTER ); + ::std::vector< OUString > aDecodedPasswords = DecodePasswords( aRecord.GetPersPasswords(), aRecord.GetPersistentIV(), + GetMasterPassword( aHandler ), css::task::PasswordRequestMode_PASSWORD_ENTER ); aPasswords.insert( aPasswords.end(), aDecodedPasswords.begin(), aDecodedPasswords.end() ); } catch( NoMasterException& ) @@ -643,6 +672,19 @@ void SAL_CALL PasswordContainer::addPersistent( const OUString& Url, const OUStr PrivateAdd( Url, UserName, Passwords, PERSISTENT_RECORD, aHandler ); } +OUString PasswordContainer::createIV() +{ + rtlRandomPool randomPool = mRandomPool.get(); + unsigned char iv[RTL_DIGEST_LENGTH_MD5]; + rtl_random_getBytes(randomPool, iv, RTL_DIGEST_LENGTH_MD5); + OUStringBuffer aBuffer; + for (sal_uInt8 i : iv) + { + aBuffer.append(OUString::number(i >> 4, 16)); + aBuffer.append(OUString::number(i & 15, 16)); + } + return aBuffer.makeStringAndClear(); +} void PasswordContainer::PrivateAdd( const OUString& Url, const OUString& UserName, const Sequence< OUString >& Passwords, char Mode, const Reference< XInteractionHandler >& aHandler ) { @@ -650,7 +692,11 @@ void PasswordContainer::PrivateAdd( const OUString& Url, const OUString& UserNam ::std::vector< OUString > aStorePass = comphelper::sequenceToContainer< std::vector<OUString> >( Passwords ); if( Mode == PERSISTENT_RECORD ) - aRecord.SetPersPasswords( EncodePasswords( aStorePass, GetMasterPassword( aHandler ) ) ); + { + OUString sIV = createIV(); + OUString sEncodedPasswords = EncodePasswords( aStorePass, sIV, GetMasterPassword( aHandler ) ); + aRecord.SetPersPasswords( sEncodedPasswords, sIV ); + } else if( Mode == MEMORY_RECORD ) aRecord.SetMemPasswords( aStorePass ); else @@ -843,10 +889,10 @@ OUString const & PasswordContainer::GetMasterPassword( const Reference< XInterac if( m_aMasterPasswd.isEmpty() && aHandler.is() ) { - OUString aEncodedMP; + OUString aEncodedMP, aEncodedMPIV; bool bDefaultPassword = false; - if( !m_pStorageFile->getEncodedMP( aEncodedMP ) ) + if( !m_pStorageFile->getEncodedMP( aEncodedMP, aEncodedMPIV ) ) aRMode = PasswordRequestMode_PASSWORD_CREATE; else if ( aEncodedMP.isEmpty() ) { @@ -868,14 +914,15 @@ OUString const & PasswordContainer::GetMasterPassword( const Reference< XInterac m_aMasterPasswd = aPass; std::vector< OUString > aMaster( 1, m_aMasterPasswd ); - m_pStorageFile->setEncodedMP( EncodePasswords( aMaster, m_aMasterPasswd ) ); + OUString sIV = createIV(); + m_pStorageFile->setEncodedMP( EncodePasswords( aMaster, sIV, m_aMasterPasswd ), sIV ); } else { if (m_pStorageFile->getStorageVersion() == 0) aPass = ReencodeAsOldHash(aPass); - std::vector< OUString > aRM( DecodePasswords( aEncodedMP, aPass, aRMode ) ); + std::vector< OUString > aRM( DecodePasswords( aEncodedMP, aEncodedMPIV, aPass, aRMode ) ); if( aRM.empty() || aPass != aRM[0] ) { bAskAgain = true; @@ -1032,7 +1079,8 @@ Sequence< UrlRecord > SAL_CALL PasswordContainer::getAllPersistent( const Refere { sal_Int32 oldLen = aUsers.getLength(); aUsers.realloc( oldLen + 1 ); - aUsers[ oldLen ] = UserRecord( aNP.GetUserName(), comphelper::containerToSequence( DecodePasswords( aNP.GetPersPasswords(), GetMasterPassword( xHandler ), css::task::PasswordRequestMode_PASSWORD_ENTER ) ) ); + aUsers[ oldLen ] = UserRecord( aNP.GetUserName(), comphelper::containerToSequence( DecodePasswords( aNP.GetPersPasswords(), aNP.GetPersistentIV(), + GetMasterPassword( xHandler ), css::task::PasswordRequestMode_PASSWORD_ENTER ) ) ); } if( aUsers.hasElements() ) @@ -1049,12 +1097,12 @@ Sequence< UrlRecord > SAL_CALL PasswordContainer::getAllPersistent( const Refere sal_Bool SAL_CALL PasswordContainer::authorizateWithMasterPassword( const uno::Reference< task::XInteractionHandler >& xHandler ) { bool bResult = false; - OUString aEncodedMP; + OUString aEncodedMP, aEncodedMPIV; uno::Reference< task::XInteractionHandler > xTmpHandler = xHandler; ::osl::MutexGuard aGuard( mMutex ); // the method should fail if there is no master password - if( m_pStorageFile && m_pStorageFile->useStorage() && m_pStorageFile->getEncodedMP( aEncodedMP ) ) + if( m_pStorageFile && m_pStorageFile->useStorage() && m_pStorageFile->getEncodedMP( aEncodedMP, aEncodedMPIV ) ) { if ( aEncodedMP.isEmpty() ) { @@ -1123,8 +1171,8 @@ sal_Bool SAL_CALL PasswordContainer::changeMasterPassword( const uno::Reference< bool bCanChangePassword = true; // if there is already a stored master password it should be entered by the user before the change happen - OUString aEncodedMP; - if( !m_aMasterPasswd.isEmpty() || m_pStorageFile->getEncodedMP( aEncodedMP ) ) + OUString aEncodedMP, aEncodedMPIV; + if( !m_aMasterPasswd.isEmpty() || m_pStorageFile->getEncodedMP( aEncodedMP, aEncodedMPIV ) ) bCanChangePassword = authorizateWithMasterPassword( xTmpHandler ); if ( bCanChangePassword ) @@ -1143,7 +1191,8 @@ sal_Bool SAL_CALL PasswordContainer::changeMasterPassword( const uno::Reference< // store the new master password m_aMasterPasswd = aPass; std::vector< OUString > aMaster( 1, m_aMasterPasswd ); - m_pStorageFile->setEncodedMP( EncodePasswords( aMaster, m_aMasterPasswd ) ); + OUString aIV = createIV(); + m_pStorageFile->setEncodedMP( EncodePasswords( aMaster, aIV, m_aMasterPasswd ), aIV ); // store all the entries with the new password for ( const auto& rURL : aPersistent ) @@ -1168,7 +1217,7 @@ void SAL_CALL PasswordContainer::removeMasterPassword() if ( m_pStorageFile ) { m_aMasterPasswd.clear(); - m_pStorageFile->setEncodedMP( OUString() ); // let the master password be removed from configuration + m_pStorageFile->setEncodedMP( OUString(), OUString() ); // let the master password be removed from configuration } } @@ -1179,8 +1228,8 @@ sal_Bool SAL_CALL PasswordContainer::hasMasterPassword( ) if ( !m_pStorageFile ) throw uno::RuntimeException(); - OUString aEncodedMP; - return ( m_pStorageFile->useStorage() && m_pStorageFile->getEncodedMP( aEncodedMP ) ); + OUString aEncodedMP, aEncodedMPIV; + return ( m_pStorageFile->useStorage() && m_pStorageFile->getEncodedMP( aEncodedMP, aEncodedMPIV ) ); } sal_Bool SAL_CALL PasswordContainer::allowPersistentStoring( sal_Bool bAllow ) @@ -1227,8 +1276,8 @@ sal_Bool SAL_CALL PasswordContainer::useDefaultMasterPassword( const uno::Refere bool bCanChangePassword = true; // if there is already a stored nondefault master password it should be entered by the user before the change happen - OUString aEncodedMP; - if( m_pStorageFile->getEncodedMP( aEncodedMP ) && !aEncodedMP.isEmpty() ) + OUString aEncodedMP, aEncodedMPIV; + if( m_pStorageFile->getEncodedMP( aEncodedMP, aEncodedMPIV ) && !aEncodedMP.isEmpty() ) bCanChangePassword = authorizateWithMasterPassword( xTmpHandler ); if ( bCanChangePassword ) @@ -1245,7 +1294,7 @@ sal_Bool SAL_CALL PasswordContainer::useDefaultMasterPassword( const uno::Refere // store the empty string to flag the default master password m_aMasterPasswd = aPass; - m_pStorageFile->setEncodedMP( OUString(), true ); + m_pStorageFile->setEncodedMP( OUString(), OUString(), true ); // store all the entries with the new password for ( const auto& rURL : aPersistent ) @@ -1269,8 +1318,8 @@ sal_Bool SAL_CALL PasswordContainer::isDefaultMasterPasswordUsed() if ( !m_pStorageFile ) throw uno::RuntimeException(); - OUString aEncodedMP; - return ( m_pStorageFile->useStorage() && m_pStorageFile->getEncodedMP( aEncodedMP ) && aEncodedMP.isEmpty() ); + OUString aEncodedMP, aEncodedMPIV; + return ( m_pStorageFile->useStorage() && m_pStorageFile->getEncodedMP( aEncodedMP, aEncodedMPIV ) && aEncodedMP.isEmpty() ); } diff --git a/svl/source/passwordcontainer/passwordcontainer.hxx b/svl/source/passwordcontainer/passwordcontainer.hxx index 87798ca045ee..032b8cb1ecda 100644 --- a/svl/source/passwordcontainer/passwordcontainer.hxx +++ b/svl/source/passwordcontainer/passwordcontainer.hxx @@ -36,6 +36,7 @@ #include <unotools/configitem.hxx> #include <ucbhelper/interactionrequest.hxx> +#include <rtl/random.h> #include <rtl/ref.hxx> #include <osl/mutex.hxx> @@ -54,11 +55,12 @@ class NamePassRecord ::std::vector< OUString > m_aMemPass; // persistent passwords are encrypted in one string - bool m_bHasPersPass; + bool m_bHasPersPass; OUString m_aPersPass; + OUString m_aPersistentIV; void InitArrays( bool bHasMemoryList, const ::std::vector< OUString >& aMemoryList, - bool bHasPersistentList, const OUString& aPersistentList ) + bool bHasPersistentList, const OUString& aPersistentList, const OUString& aPersistentIV ) { m_bHasMemPass = bHasMemoryList; if ( bHasMemoryList ) @@ -66,7 +68,10 @@ class NamePassRecord m_bHasPersPass = bHasPersistentList; if ( bHasPersistentList ) + { m_aPersPass = aPersistentList; + m_aPersistentIV = aPersistentIV; + } } public: @@ -78,11 +83,12 @@ public: { } - NamePassRecord( const OUString& aName, const OUString& aPersistentList ) + NamePassRecord( const OUString& aName, const OUString& aPersistentList, const OUString& aPersistentIV ) : m_aName( aName ) , m_bHasMemPass( false ) , m_bHasPersPass( true ) , m_aPersPass( aPersistentList ) + , m_aPersistentIV( aPersistentIV ) { } @@ -91,7 +97,8 @@ public: , m_bHasMemPass( false ) , m_bHasPersPass( false ) { - InitArrays( aRecord.m_bHasMemPass, aRecord.m_aMemPass, aRecord.m_bHasPersPass, aRecord.m_aPersPass ); + InitArrays( aRecord.m_bHasMemPass, aRecord.m_aMemPass, + aRecord.m_bHasPersPass, aRecord.m_aPersPass, aRecord.m_aPersistentIV ); } NamePassRecord& operator=( const NamePassRecord& aRecord ) @@ -102,7 +109,9 @@ public: m_aMemPass.clear(); m_aPersPass.clear(); - InitArrays( aRecord.m_bHasMemPass, aRecord.m_aMemPass, aRecord.m_bHasPersPass, aRecord.m_aPersPass ); + m_aPersistentIV.clear(); + InitArrays( aRecord.m_bHasMemPass, aRecord.m_aMemPass, + aRecord.m_bHasPersPass, aRecord.m_aPersPass, aRecord.m_aPersistentIV ); } return *this; } @@ -138,15 +147,24 @@ public: return OUString(); } + OUString GetPersistentIV() const + { + if ( m_bHasPersPass ) + return m_aPersistentIV; + + return OUString(); + } + void SetMemPasswords( const ::std::vector< OUString >& aMemList ) { m_aMemPass = aMemList; m_bHasMemPass = true; } - void SetPersPasswords( const OUString& aPersList ) + void SetPersPasswords( const OUString& aPersList, const OUString& aPersIV ) { m_aPersPass = aPersList; + m_aPersistentIV = aPersIV; m_bHasPersPass = true; } @@ -161,6 +179,7 @@ public: { m_bHasPersPass = false; m_aPersPass.clear(); + m_aPersistentIV.clear(); } } @@ -184,6 +203,7 @@ private: PasswordContainer* mainCont; bool hasEncoded; OUString mEncoded; + OUString mEncodedIV; virtual void ImplCommit() override; @@ -204,8 +224,8 @@ public: sal_Int32 getStorageVersion(); - bool getEncodedMP( OUString& aResult ); - void setEncodedMP( const OUString& aResult, bool bAcceptEnmpty = false ); + bool getEncodedMP( OUString& aResult, OUString& aResultIV ); + void setEncodedMP( const OUString& aResult, const OUString& aResultIV, bool bAcceptEmpty = false ); void setUseStorage( bool bUse ); bool useStorage(); @@ -226,6 +246,29 @@ private: css::uno::Reference< css::lang::XComponent > mComponent; SysCredentialsConfig mUrlContainer; + class RandomPool + { + private: + rtlRandomPool m_aRandomPool; + public: + RandomPool() : m_aRandomPool(rtl_random_createPool()) + { + } + rtlRandomPool get() + { + return m_aRandomPool; + } + ~RandomPool() + { + // Clean up random pool memory + rtl_random_destroyPool(m_aRandomPool); + } + }; + + RandomPool mRandomPool; + + OUString createIV(); + /// @throws css::uno::RuntimeException css::uno::Sequence< css::task::UserRecord > CopyToUserRecordSequence( const ::std::vector< NamePassRecord >& original, @@ -276,10 +319,10 @@ css::task::UrlRecord find( const css::uno::Reference< css::task::XInteractionHandler >& Handler ); /// @throws css::uno::RuntimeException - static ::std::vector< OUString > DecodePasswords( const OUString& aLine, const OUString& aMasterPassword, css::task::PasswordRequestMode mode ); + static ::std::vector< OUString > DecodePasswords( const OUString& aLine, const OUString& aIV, const OUString& aMasterPassword, css::task::PasswordRequestMode mode ); /// @throws css::uno::RuntimeException - static OUString EncodePasswords(const std::vector< OUString >& lines, const OUString& aMasterPassword ); + static OUString EncodePasswords(const std::vector< OUString >& lines, const OUString& aIV, const OUString& aMasterPassword ); public: PasswordContainer( const css::uno::Reference< css::lang::XMultiServiceFactory >& ); commit cefb982c4264df848b4fdc88dffbf33c89732f36 Author: Arkadiy Illarionov <qar...@gmail.com> AuthorDate: Sat Jul 13 21:29:10 2019 +0300 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Sun Oct 30 00:52:38 2022 +0200 Simplify Sequence iterations in svl [only passwordcontainer.cxx] Use range-based loops, STL and comphelper functions Reviewed-on: https://gerrit.libreoffice.org/75563 Tested-by: Jenkins Reviewed-by: Arkadiy Illarionov <qar...@gmail.com> (cherry picked from commit c9cce0d931b41ede0eca14b2ed2b84453f048362) Change-Id: I1c3dbf194600bec60c0881d2d19ff07b89d8333b diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx index 12dcd19dae77..75aa904474c8 100644 --- a/svl/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -186,22 +186,20 @@ PassMap StorageItem::getInfo() Sequence< OUString > aNodeNames = ConfigItem::GetNodeNames( "Store" ); sal_Int32 aNodeCount = aNodeNames.getLength(); Sequence< OUString > aPropNames( aNodeCount ); - sal_Int32 aNodeInd; - for( aNodeInd = 0; aNodeInd < aNodeCount; ++aNodeInd ) - { - aPropNames[aNodeInd] = "Store/Passwordstorage['" + aNodeNames[aNodeInd] + "']/Password"; - } + std::transform(aNodeNames.begin(), aNodeNames.end(), aPropNames.begin(), + [](const OUString& rName) -> OUString { + return "Store/Passwordstorage['" + rName + "']/Password"; }); Sequence< Any > aPropertyValues = ConfigItem::GetProperties( aPropNames ); - if( aPropertyValues.getLength() != aNodeNames.getLength() ) + if( aPropertyValues.getLength() != aNodeCount ) { - OSL_ENSURE( aPropertyValues.getLength() == aNodeNames.getLength(), "Problems during reading" ); + OSL_FAIL( "Problems during reading" ); return aResult; } - for( aNodeInd = 0; aNodeInd < aNodeCount; ++aNodeInd ) + for( sal_Int32 aNodeInd = 0; aNodeInd < aNodeCount; ++aNodeInd ) { std::vector< OUString > aUrlUsr = getInfoFromInd( aNodeNames[aNodeInd] ); @@ -254,7 +252,7 @@ bool StorageItem::useStorage() if( aPropertyValues.getLength() != aNodeNames.getLength() ) { - OSL_ENSURE( aPropertyValues.getLength() == aNodeNames.getLength(), "Problems during reading" ); + OSL_FAIL( "Problems during reading" ); return false; } @@ -298,7 +296,7 @@ bool StorageItem::getEncodedMP( OUString& aResult ) if( aPropertyValues.getLength() != aNodeNames.getLength() ) { - OSL_ENSURE( aPropertyValues.getLength() == aNodeNames.getLength(), "Problems during reading" ); + OSL_FAIL( "Problems during reading" ); return false; } @@ -1148,11 +1146,9 @@ sal_Bool SAL_CALL PasswordContainer::changeMasterPassword( const uno::Reference< m_pStorageFile->setEncodedMP( EncodePasswords( aMaster, m_aMasterPasswd ) ); // store all the entries with the new password - for ( int nURLInd = 0; nURLInd < aPersistent.getLength(); nURLInd++ ) - for ( int nNameInd = 0; nNameInd< aPersistent[nURLInd].UserList.getLength(); nNameInd++ ) - addPersistent( aPersistent[nURLInd].Url, - aPersistent[nURLInd].UserList[nNameInd].UserName, - aPersistent[nURLInd].UserList[nNameInd].Passwords, + for ( const auto& rURL : aPersistent ) + for ( const auto& rUser : rURL.UserList ) + addPersistent( rURL.Url, rUser.UserName, rUser.Passwords, uno::Reference< task::XInteractionHandler >() ); bResult = true; @@ -1252,11 +1248,9 @@ sal_Bool SAL_CALL PasswordContainer::useDefaultMasterPassword( const uno::Refere m_pStorageFile->setEncodedMP( OUString(), true ); // store all the entries with the new password - for ( int nURLInd = 0; nURLInd < aPersistent.getLength(); nURLInd++ ) - for ( int nNameInd = 0; nNameInd< aPersistent[nURLInd].UserList.getLength(); nNameInd++ ) - addPersistent( aPersistent[nURLInd].Url, - aPersistent[nURLInd].UserList[nNameInd].UserName, - aPersistent[nURLInd].UserList[nNameInd].Passwords, + for ( const auto& rURL : aPersistent ) + for ( const auto& rUser : rURL.UserList ) + addPersistent( rURL.Url, rUser.UserName, rUser.Passwords, uno::Reference< task::XInteractionHandler >() ); bResult = true; commit 893dde23ecd2a15daad825e603b479407ff5df18 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Mar 21 20:58:34 2022 +0000 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Sun Oct 30 00:49:32 2022 +0200 make hash encoding match decoding Seeing as old versions of the hash may be in the users config, add a StorageVersion field to the office config Passwords section which defaults to 0 to indicate the old hash is in use. Try the old varient when StorageVersion is 0. When a new encoded master password it set write StorageVersion of 1 to indicate a new hash is in use and use the new style when StorageVersion is 1. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132080 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> (cherry picked from commit e890f54dbac57f3ab5acf4fbd31222095d3e8ab6) svl: fix crash if user cancels/closes master password dialog (regression from d7ba5614d90381d68f880ca7e7c5ef8bbb1b1c43) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133932 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit bbb8617ece6d946957c2eb96287081029bce530f) Change-Id: I3174c37a5891bfc849984e0ec5c2c392b9c6e7b1 (cherry picked from commit 7e35d53f51bb89ed3cea5f946214afb7d81e1b1e) diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index b0c738194f25..c1890efc4599 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -911,6 +911,12 @@ </info> <value>false</value> </prop> + <prop oor:name="StorageVersion" oor:type="xs:int" oor:nillable="false"> + <info> + <desc>Specifies what version of encoding scheme the password container uses.</desc> + </info> + <value>0</value> + </prop> <prop oor:name="HasMaster" oor:type="xs:boolean" oor:nillable="false"> <info> <desc>Specifies if there is a valid master password.</desc> diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx index 5c59f976d8ec..12dcd19dae77 100644 --- a/svl/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> +#include <sal/log.hxx> #include "passwordcontainer.hxx" @@ -262,6 +264,23 @@ bool StorageItem::useStorage() return aResult; } +sal_Int32 StorageItem::getStorageVersion() +{ + Sequence<OUString> aNodeNames { "StorageVersion" }; + + Sequence< Any > aPropertyValues = ConfigItem::GetProperties( aNodeNames ); + + if( aPropertyValues.getLength() != aNodeNames.getLength() ) + { + OSL_FAIL( "Problems during reading" ); + return 0; + } + + sal_Int32 nResult = 0; + aPropertyValues[0] >>= nResult; + + return nResult; +} bool StorageItem::getEncodedMP( OUString& aResult ) { @@ -294,15 +313,17 @@ bool StorageItem::getEncodedMP( OUString& aResult ) void StorageItem::setEncodedMP( const OUString& aEncoded, bool bAcceptEmpty ) { - Sequence< OUString > sendNames(2); - Sequence< uno::Any > sendVals(2); + Sequence< OUString > sendNames(3); + Sequence< uno::Any > sendVals(3); sendNames[0] = "HasMaster"; sendNames[1] = "Master"; + sendNames[2] = "StorageVersion"; bool bHasMaster = ( !aEncoded.isEmpty() || bAcceptEmpty ); sendVals[0] <<= bHasMaster; sendVals[1] <<= aEncoded; + sendVals[2] <<= nCurrentStorageVersion; ConfigItem::SetModified(); ConfigItem::PutProperties( sendNames, sendVals ); @@ -803,6 +824,18 @@ OUString PasswordContainer::RequestPasswordFromUser( PasswordRequestMode aRMode, return aResult; } +// Mangle the key to match an old bug +static OUString ReencodeAsOldHash(const OUString& rPass) +{ + OUStringBuffer aBuffer; + for (int ind = 0; ind < RTL_DIGEST_LENGTH_MD5; ++ind) + { + unsigned char i = static_cast<char>(rPass.copy(ind * 2, 2).toUInt32(16)); + aBuffer.append(static_cast< sal_Unicode >('a' + (i >> 4))); + aBuffer.append(static_cast< sal_Unicode >('a' + (i & 15))); + } + return aBuffer.makeStringAndClear(); +} OUString const & PasswordContainer::GetMasterPassword( const Reference< XInteractionHandler >& aHandler ) { @@ -841,6 +874,9 @@ OUString const & PasswordContainer::GetMasterPassword( const Reference< XInterac } else { + if (m_pStorageFile->getStorageVersion() == 0) + aPass = ReencodeAsOldHash(aPass); + std::vector< OUString > aRM( DecodePasswords( aEncodedMP, aPass, aRMode ) ); if( aRM.empty() || aPass != aRM[0] ) { @@ -1045,6 +1081,13 @@ sal_Bool SAL_CALL PasswordContainer::authorizateWithMasterPassword( const uno::R do { aPass = RequestPasswordFromUser( aRMode, xTmpHandler ); + + + if (!aPass.isEmpty() && m_pStorageFile->getStorageVersion() == 0) + { + aPass = ReencodeAsOldHash(aPass); + } + bResult = ( !aPass.isEmpty() && aPass == m_aMasterPasswd ); aRMode = PasswordRequestMode_PASSWORD_REENTER; // further questions with error notification } while( !bResult && !aPass.isEmpty() ); diff --git a/svl/source/passwordcontainer/passwordcontainer.hxx b/svl/source/passwordcontainer/passwordcontainer.hxx index 878eeb8fadaf..87798ca045ee 100644 --- a/svl/source/passwordcontainer/passwordcontainer.hxx +++ b/svl/source/passwordcontainer/passwordcontainer.hxx @@ -170,6 +170,10 @@ public: typedef ::std::pair< const OUString, ::std::vector< NamePassRecord > > PairUrlRecord; typedef ::std::map< OUString, ::std::vector< NamePassRecord > > PassMap; +// org.openoffice.Office.Common/Passwords/StorageVersion bump if details of +// how password details are saved changes. Enables migration from previous +// schemes. +constexpr sal_Int32 nCurrentStorageVersion = 1; class PasswordContainer; @@ -198,6 +202,8 @@ public: void remove( const OUString& url, const OUString& rec ); void clear(); + sal_Int32 getStorageVersion(); + bool getEncodedMP( OUString& aResult ); void setEncodedMP( const OUString& aResult, bool bAcceptEnmpty = false ); void setUseStorage( bool bUse ); diff --git a/uui/source/iahndl-authentication.cxx b/uui/source/iahndl-authentication.cxx index 114cf8b87563..d557fb75cbd5 100644 --- a/uui/source/iahndl-authentication.cxx +++ b/uui/source/iahndl-authentication.cxx @@ -436,8 +436,9 @@ executeMasterPasswordDialog( OUStringBuffer aBuffer; for (sal_uInt8 i : aKey) { - aBuffer.append(static_cast< sal_Unicode >('a' + (i >> 4))); - aBuffer.append(static_cast< sal_Unicode >('a' + (i & 15))); + // match PasswordContainer::DecodePasswords aMasterPasswd.copy(index * 2, 2).toUInt32(16)); + aBuffer.append(OUString::number(i >> 4, 16)); + aBuffer.append(OUString::number(i & 15, 16)); } rInfo.SetPassword(aBuffer.makeStringAndClear()); }