summaryrefslogtreecommitdiff
path: root/xpdf/xpdf-3.02-ooopwd.patch
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2012-11-13 10:27:21 +0200
committerTor Lillqvist <tml@iki.fi>2012-11-13 10:28:15 +0200
commit97d8b882210c5a7f3bf6b3d53bfef1fb9a487acf (patch)
tree9ca1404bdfc4fb13339d57ff3db39e369b7c9f9d /xpdf/xpdf-3.02-ooopwd.patch
parent39f9eb0d856293a974e2f024b29dca20068af073 (diff)
Revert "fdo#38878 upgrade xpdf to poppler"
Also revert my two minor follow-up popper commits. Poppler doesn't build on Mac OS X. It uses fontconfig, and we don't depend on that on the Mac. There is a patch from 2009 http://lists.freedesktop.org/archives/poppler/2009-July/004932.html (actual patch at http://lists.freedesktop.org/archives/poppler/attachments/20090712/f3b154d0/attachment-0001.obj ) that makes poppler not use fontconfig on the Mac, but it was never upstreamed. And that patch uses the obsolete ATSUI API, which we want to stop using in LO code, not introduce new uses of. This reverts commit 39f9eb0d856293a974e2f024b29dca20068af073. This reverts commit 0941c211858416f6117548e093b428b64785f98a. This reverts commit a6e9bb4c7bad649cb44efaeef67fa18090348c53.
Diffstat (limited to 'xpdf/xpdf-3.02-ooopwd.patch')
-rw-r--r--xpdf/xpdf-3.02-ooopwd.patch101
1 files changed, 101 insertions, 0 deletions
diff --git a/xpdf/xpdf-3.02-ooopwd.patch b/xpdf/xpdf-3.02-ooopwd.patch
new file mode 100644
index 000000000000..f773585b3f91
--- /dev/null
+++ b/xpdf/xpdf-3.02-ooopwd.patch
@@ -0,0 +1,101 @@
+--- misc/xpdf-3.02/xpdf/SecurityHandler.cc 2007-02-27 23:05:52.000000000 +0100
++++ misc/build/xpdf-3.02/xpdf/SecurityHandler.cc 2011-02-03 16:41:49.000000000 +0100
+@@ -40,7 +40,7 @@
+
+ encryptDictA->dictLookup("Filter", &filterObj);
+ if (filterObj.isName("Standard")) {
+- secHdlr = new StandardSecurityHandler(docA, encryptDictA);
++ secHdlr = new OOoImportSecurityhandler(docA, encryptDictA);
+ } else if (filterObj.isName()) {
+ #ifdef ENABLE_PLUGINS
+ if ((xsh = globalParams->getSecurityHandler(filterObj.getName()))) {
+@@ -310,6 +310,60 @@
+ return gTrue;
+ }
+
++//------------------------------------------------------------------------
++// OOoImportSecurityhandler
++//------------------------------------------------------------------------
++
++OOoImportSecurityhandler::~OOoImportSecurityhandler()
++{
++}
++
++inline Guchar toNum( Guchar digit )
++{
++ return (digit >= '0') && digit <= '9'
++ ? digit - '0'
++ : (digit >= 'A' && digit <= 'F')
++ ? digit - 'A' + 10
++ : (digit >= 'a' && digit <= 'f')
++ ? digit - 'a' + 10
++ : Guchar(0xff);
++}
++
++GBool OOoImportSecurityhandler::authorize(void* authData)
++{
++ if( !ok )
++ return gFalse;
++ if( authData )
++ {
++ GString* ownerPassword = ((StandardAuthData *)authData)->ownerPassword;
++ if( ownerPassword )
++ {
++ const char* pStr = ownerPassword->getCString();
++ if( strncmp( pStr, "_OOO_pdfi_Credentials_", 22 ) == 0 )
++ {
++ // a hex encoded byte sequence should follow until end of string
++ // the length must match fileKeyLength
++ // if this is the case we can assume that the password checked out
++ // and the file key is valid
++ // max len is 16 (the size of the fileKey array)
++ pStr += 22;
++ size_t i = 0;
++ while( pStr[0] && pStr[1] && i < sizeof( fileKey ) )
++ {
++ fileKey[i++] = (toNum( *pStr++ ) << 4)
++ | (toNum( *pStr++ ));
++ }
++ if( i == size_t(fileKeyLength) )
++ {
++ ownerPasswordOk = gTrue;
++ return gTrue;
++ }
++ }
++ }
++ }
++ return StandardSecurityHandler::authorize( authData );
++}
++
+ #ifdef ENABLE_PLUGINS
+
+ //------------------------------------------------------------------------
+--- misc/xpdf-3.02/xpdf/SecurityHandler.h 2007-02-27 23:05:52.000000000 +0100
++++ misc/build/xpdf-3.02/xpdf/SecurityHandler.h 2011-02-03 16:26:17.000000000 +0100
+@@ -103,7 +103,7 @@
+ virtual int getEncVersion() { return encVersion; }
+ virtual CryptAlgorithm getEncAlgorithm() { return encAlgorithm; }
+
+-private:
++protected:
+
+ int permFlags;
+ GBool ownerPasswordOk;
+@@ -119,6 +119,17 @@
+ GBool ok;
+ };
+
++class OOoImportSecurityhandler : public StandardSecurityHandler
++{
++public:
++ OOoImportSecurityhandler( PDFDoc* docA, Object* encryptDictA )
++ : StandardSecurityHandler( docA, encryptDictA )
++ {}
++ virtual ~OOoImportSecurityhandler();
++
++ virtual GBool authorize(void* authData);
++};
++
+ #ifdef ENABLE_PLUGINS
+ //------------------------------------------------------------------------
+ // ExternalSecurityHandler