aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf/qtest
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2012-07-29 19:22:37 +0200
committerJay Berkenbilt <ejb@ql.org>2012-07-29 19:22:37 +0200
commitbde98044f4acd5ce0e1965ad28a6854c31aa29a1 (patch)
tree49441021dd641e61feb1aa40e41e08fbdacf865f /qpdf/qtest
parentf83bddf882094b1047443a7c0866a6f942567017 (diff)
downloadqpdf-bde98044f4acd5ce0e1965ad28a6854c31aa29a1.tar.zst
Improve password handling
Use --encryption-file-password, if given, in addition to --password as a source for passwords for files specified in --pages.
Diffstat (limited to 'qpdf/qtest')
-rw-r--r--qpdf/qtest/qpdf.test11
-rw-r--r--qpdf/qtest/qpdf/pages-copy-encryption.pdfbin0 -> 1319 bytes
2 files changed, 10 insertions, 1 deletions
diff --git a/qpdf/qtest/qpdf.test b/qpdf/qtest/qpdf.test
index 8cdc82a7..da318491 100644
--- a/qpdf/qtest/qpdf.test
+++ b/qpdf/qtest/qpdf.test
@@ -424,7 +424,7 @@ foreach my $d (@nrange_tests)
# ----------
$td->notify("--- Merging and Splitting ---");
-$n_tests += 4;
+$n_tests += 6;
# Select pages from the same file multiple times including selecting
# twice from an encrypted file and specifying the password only the
@@ -460,6 +460,15 @@ $td->runtest("merge three files",
$td->runtest("check output",
{$td->FILE => "a.pdf"},
{$td->FILE => "merge-three-files-2.pdf"});
+$td->runtest("avoid respecification of password",
+ {$td->COMMAND =>
+ "qpdf --empty a.pdf --copy-encryption=20-pages.pdf" .
+ " --encryption-file-password=user" .
+ " --pages 20-pages.pdf 1,z -- --static-id"},
+ {$td->STRING => "", $td->EXIT_STATUS => 0});
+$td->runtest("check output",
+ {$td->FILE => "a.pdf"},
+ {$td->FILE => "pages-copy-encryption.pdf"});
# ----------
$td->notify("--- PDF From Scratch ---");
$n_tests += 2;
diff --git a/qpdf/qtest/qpdf/pages-copy-encryption.pdf b/qpdf/qtest/qpdf/pages-copy-encryption.pdf
new file mode 100644
index 00000000..40280642
--- /dev/null
+++ b/qpdf/qtest/qpdf/pages-copy-encryption.pdf
Binary files differ