Port Johannes Bauer's protection patch to 3.04.
This does NOT disable the error messages, since the user should
be aware of the author's intent.

Also, this does not deal with permission to print.

diff --git a/xpdf/PDFCore.cc b/xpdf/PDFCore.cc
index 34b6483..e93fe52 100644
--- a/xpdf/PDFCore.cc
+++ b/xpdf/PDFCore.cc
@@ -1677,9 +1677,6 @@ GString *PDFCore::extractText(int pg, double xMin, double yMin,
   int x0, y0, x1, y1, t;
   GString *s;
 
-  if (!doc->okToCopy()) {
-    return NULL;
-  }
   if ((page = findPage(pg))) {
     cvtUserToDev(pg, xMin, yMin, &x0, &y0);
     cvtUserToDev(pg, xMax, yMax, &x1, &y1);
diff --git a/xpdf/XPDFCore.cc b/xpdf/XPDFCore.cc
index 9a3725f..1562c7a 100644
--- a/xpdf/XPDFCore.cc
+++ b/xpdf/XPDFCore.cc
@@ -384,9 +384,8 @@ void XPDFCore::endSelection(int wx, int wy) {
 #ifndef NO_TEXT_SELECT
       if (selectULX != selectLRX &&
 	  selectULY != selectLRY) {
-	if (doc->okToCopy()) {
 	  copySelection();
-	} else {
+	if (!doc->okToCopy()) {
 	  error(errNotAllowed, -1,
 		"Copying of text from this document is not allowed.");
 	}
@@ -408,9 +407,6 @@ void XPDFCore::copySelection() {
   int pg;
   double ulx, uly, lrx, lry;
 
-  if (!doc->okToCopy()) {
-    return;
-  }
   if (getSelection(&pg, &ulx, &uly, &lrx, &lry)) {
     //~ for multithreading: need a mutex here
     if (currentSelection) {
diff --git a/xpdf/pdfimages.cc b/xpdf/pdfimages.cc
index dc79443..9aaa811 100644
--- a/xpdf/pdfimages.cc
+++ b/xpdf/pdfimages.cc
@@ -122,8 +122,6 @@ int main(int argc, char *argv[]) {
   if (!doc->okToCopy()) {
     error(errNotAllowed, -1,
 	  "Copying of images from this document is not allowed.");
-    exitCode = 3;
-    goto err1;
   }
 
   // get page range
diff --git a/xpdf/pdftohtml.cc b/xpdf/pdftohtml.cc
index f1fe691..824233e 100644
--- a/xpdf/pdftohtml.cc
+++ b/xpdf/pdftohtml.cc
@@ -134,8 +134,6 @@ int main(int argc, char *argv[]) {
   if (!doc->okToCopy()) {
     error(errNotAllowed, -1,
 	  "Copying of text from this document is not allowed.");
-    exitCode = 3;
-    goto err1;
   }
 
   // get page range
diff --git a/xpdf/pdftotext.cc b/xpdf/pdftotext.cc
index 758413e..e6779fa 100644
--- a/xpdf/pdftotext.cc
+++ b/xpdf/pdftotext.cc
@@ -192,8 +192,6 @@ int main(int argc, char *argv[]) {
   if (!doc->okToCopy()) {
     error(errNotAllowed, -1,
 	  "Copying of text from this document is not allowed.");
-    exitCode = 3;
-    goto err2;
   }
 
   // construct text file name
