diff options
author | Will Andrews <will@FreeBSD.org> | 2003-04-11 14:39:16 +0000 |
---|---|---|
committer | Will Andrews <will@FreeBSD.org> | 2003-04-11 14:39:16 +0000 |
commit | 145f2547fa612edc0d309eb34ae7adfd02587bb2 (patch) | |
tree | 3eb90d62ccaa281283ff920f4921c07207478afd /graphics/kdegraphics3 | |
parent | New port: wmmemfree (diff) |
Upgrade to 3.1.1a to handle PS/PDF security advisory. There are additional
patches to kgv which are also included in this commit.
Submitted by: Lauri Watts <lauri@kde.org>
Diffstat (limited to 'graphics/kdegraphics3')
4 files changed, 186 insertions, 0 deletions
diff --git a/graphics/kdegraphics3/files/patch-kghostview-kgv_miniwidget.cpp b/graphics/kdegraphics3/files/patch-kghostview-kgv_miniwidget.cpp new file mode 100644 index 000000000000..625e7d5f6f83 --- /dev/null +++ b/graphics/kdegraphics3/files/patch-kghostview-kgv_miniwidget.cpp @@ -0,0 +1,85 @@ +--- kghostview/kgv_miniwidget.cpp.orig Fri Jan 3 05:55:05 2003 ++++ kghostview/kgv_miniwidget.cpp Mon Apr 7 17:01:29 2003 +@@ -293,23 +293,22 @@ void KGVMiniWidget::openPDFFileContinue( + } + + _tmpDSC->close(); +- _pdfFileName = _fileName; +- _fileName = _tmpDSC->name(); + _format = PDF; + +- openPSFile(); ++ openPSFile(_tmpDSC->name()); + } + +-void KGVMiniWidget::openPSFile() ++void KGVMiniWidget::openPSFile(const QString &file) + { ++ QString fileName = file.isEmpty() ? _fileName : file; + kdDebug(4500) << "KGVMiniWidget::openPSFile" << endl; + +- FILE* fp = fopen( QFile::encodeName( _fileName ), "r"); ++ FILE* fp = fopen( QFile::encodeName( fileName ), "r"); + if( fp == 0 ) + { + KMessageBox::error( _part->widget(), + i18n( "<qt>Error opening file <nobr><strong>%1</strong></nobr>: %2</qt>" ) +- .arg( _fileName ) ++ .arg( fileName ) + .arg( strerror( errno ) ) ); + emit canceled( "" ); + return; +@@ -320,9 +319,7 @@ void KGVMiniWidget::openPSFile() + _isFileOpen = true; + scanDSC(); + buildTOC(); +- _psWidget->setFileName( dsc()->isStructured() +- ? QString::null +- : _fileName ); ++ _psWidget->setFileName( _fileName, dsc()->isStructured() ); + emit completed(); + } + } +@@ -859,6 +856,7 @@ bool KGVMiniWidget::convertFromPDF( cons + << "-dNOPAUSE" + << "-dBATCH" + << "-dSAFER" ++ << "-dPARANOIDSAFER" + << "-sDEVICE=pswrite" + << ( QCString("-sOutputFile=")+QFile::encodeName(saveFileName) ) + << ( QString("-dFirstPage=")+QString::number( firstPage ) ) +@@ -867,7 +865,7 @@ bool KGVMiniWidget::convertFromPDF( cons + << "save" + << "pop" + << "-f" +- << QFile::encodeName(_pdfFileName); ++ << QFile::encodeName(_fileName); + + /*QValueList<QCString> args = process.args(); + QValueList<QCString>::Iterator it = args.begin(); +@@ -1074,7 +1072,7 @@ void KGVMiniWidget::saveAs() + QString::null, + _part->widget(), + QString::null ); +- if( !KIO::NetAccess::upload( _format == PDF ? _pdfFileName : _fileName, ++ if( !KIO::NetAccess::upload( _fileName, + saveURL ) ) + ; // TODO: Proper error dialog + } +@@ -1311,10 +1309,16 @@ void Pdf2dsc::run( const QString& pdfNam + + _process = new KProcess; + *_process << _ghostscriptPath ++ << "-dSAFER" ++ << "-dPARANOIDSAFER" ++ << "-dDELAYSAFER" + << "-dNODISPLAY" + << "-dQUIET" + << QString( "-sPDFname=%1" ).arg( pdfName ) + << QString( "-sDSCname=%1" ).arg( dscName ) ++ << "-c" ++ << "<< /PermitFileReading [ PDFname ] /PermitFileWriting [ DSCname ] /PermitFileControl [] >> setuserparams .locksafe" ++ << "-f" + << "pdf2dsc.ps" + << "-c" + << "quit"; diff --git a/graphics/kdegraphics3/files/patch-kghostview-kgv_miniwidget.h b/graphics/kdegraphics3/files/patch-kghostview-kgv_miniwidget.h new file mode 100644 index 000000000000..d7b262c7c984 --- /dev/null +++ b/graphics/kdegraphics3/files/patch-kghostview-kgv_miniwidget.h @@ -0,0 +1,28 @@ +--- kghostview/kgv_miniwidget.h.orig Sun Sep 15 23:12:40 2002 ++++ kghostview/kgv_miniwidget.h Mon Apr 7 17:02:48 2003 +@@ -85,7 +85,7 @@ protected: + void clearTemporaryFiles(); + + void uncompressFile(); +- void openPSFile(); ++ void openPSFile(const QString &file=QString::null); + + protected slots: + void doOpenFile(); +@@ -116,7 +116,7 @@ protected: + /*- PRINTING and SAVING ---------------------------------------------------*/ + + // private data used: +-// Document specific: _dsc, _fileName, _pdfFileName, _format, _origurl ++// Document specific: _dsc, _fileName, _format, _origurl + // View specific: _currentPage, _marklist + // This section only: _printer, _tmpFromPDF + +@@ -267,7 +267,6 @@ private: + int _visiblePage; + + QString _fileName; +- QString _pdfFileName; + QString _mimetype; + + MarkList* _marklist; diff --git a/graphics/kdegraphics3/files/patch-kghostview-kpswidget.cpp b/graphics/kdegraphics3/files/patch-kghostview-kpswidget.cpp new file mode 100644 index 000000000000..d4b9cd3c6bb4 --- /dev/null +++ b/graphics/kdegraphics3/files/patch-kghostview-kpswidget.cpp @@ -0,0 +1,48 @@ +--- kghostview/kpswidget.cpp.orig Sun Sep 15 23:12:40 2002 ++++ kghostview/kpswidget.cpp Mon Apr 7 17:04:00 2003 +@@ -309,10 +309,11 @@ void KPSWidget::setGhostscriptArguments( + } + } + +-void KPSWidget::setFileName( const QString& fileName ) ++void KPSWidget::setFileName( const QString& fileName, bool usePipe ) + { +- if( _fileName != fileName ) ++ if(( _fileName != fileName ) || (_usePipe != usePipe)) + { ++ _usePipe = usePipe; + _fileName = fileName; + stopInterpreter(); + _ghostscriptDirty = true; +@@ -508,8 +509,11 @@ void KPSWidget::startInterpreter() + for( ; it != _ghostscriptArguments.end(); ++it ) + *_process << (*it); + +- if( _fileName.isEmpty() ) +- *_process << "-"; ++ if( _usePipe ) ++ *_process << ++ // The following two lines are their to ensure that we are allowed to read _fileName ++ "-dDELAYSAFER" << "-sInputFile="+_fileName << "-c" << ++ "<< /PermitFileReading [ InputFile ] /PermitFileWriting [] /PermitFileControl [] >> setuserparams .locksafe"; + else + *_process << _fileName << "-c" << "quit"; + +@@ -527,7 +531,7 @@ void KPSWidget::startInterpreter() + // Finally fire up the interpreter. + kdDebug(4500) << "KPSWidget: starting interpreter" << endl; + if( _process->start( KProcess::NotifyOnExit, +- _fileName.isEmpty() ? KProcess::All : KProcess::AllOutput ) ) ++ _usePipe ? KProcess::All : KProcess::AllOutput ) ) + { + _interpreterBusy = true; + setCursor( waitCursor ); +@@ -648,7 +652,7 @@ void KPSWidget::readSettings() + if( !intConfig->platformFonts() ) + arguments << "-dNOPLATFONTS"; + +- arguments << "-dNOPAUSE" << "-dQUIET" << "-dSAFER"; ++ arguments << "-dNOPAUSE" << "-dQUIET" << "-dSAFER" << "-dPARANOIDSAFER"; + + setGhostscriptArguments( arguments ); + diff --git a/graphics/kdegraphics3/files/patch-kghostview-kpswidget.h b/graphics/kdegraphics3/files/patch-kghostview-kpswidget.h new file mode 100644 index 000000000000..e8dbbeeb1915 --- /dev/null +++ b/graphics/kdegraphics3/files/patch-kghostview-kpswidget.h @@ -0,0 +1,25 @@ +--- kghostview/kpswidget.h.orig Sun Sep 15 23:12:40 2002 ++++ kghostview/kpswidget.h Mon Apr 7 17:05:04 2003 +@@ -134,10 +134,11 @@ public: + bool sendPS( FILE*, unsigned int begin, unsigned int end ); + + /** +- * Sets the filename of the ghostscript input. Usually we use a pipe for +- * communication and no filename will be needed. ++ * Sets the filename of the ghostscript input. ++ * @p usePipe indicates whether we use a pipe for ++ * communication or let ghoscript read the file itself. + */ +- void setFileName( const QString& ); ++ void setFileName( const QString&, bool usePipe ); + + /** + * Set the bounding box of the drawable. See my comment in the source +@@ -243,6 +244,7 @@ private: + QString _ghostscriptPath; + QStringList _ghostscriptArguments; + QString _fileName; ++ bool _usePipe; + + /** + * Flag set when one of the properties _ghostscriptPath, |