mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-22 14:48:28 +00:00
fix bug in C API, test invalid password specifically
git-svn-id: svn+q:///qpdf/trunk@832 71b93d88-0707-0410-a8cf-f5a4172ac649
This commit is contained in:
parent
8b073eed28
commit
ad0ab25d66
5
TODO
5
TODO
@ -16,11 +16,6 @@
|
||||
* Add comments for the security functions that map them back to the
|
||||
items in Adobe's products.
|
||||
|
||||
* Change the C error interface so that warnings and errors are
|
||||
pointers that can be queried using more C API functions. We need a
|
||||
way to get a full string as well as an error code, file name,
|
||||
offset, and message.
|
||||
|
||||
* "Delphi wrapper unit 'qpdf.pas' created by Zarko Gajic
|
||||
(http://delphi.about.com). .. use at your own risk and for whatever
|
||||
the purpose you want .. no support provided. Sample code provided."
|
||||
|
@ -51,7 +51,7 @@ static void call_read(qpdf_data qpdf)
|
||||
}
|
||||
|
||||
// must set qpdf->filename
|
||||
static void call_init_write(qpdf_data qpdf)
|
||||
void call_init_write(qpdf_data qpdf)
|
||||
{
|
||||
qpdf->qpdf_writer = new QPDFWriter(*(qpdf->qpdf), qpdf->filename);
|
||||
}
|
||||
@ -76,10 +76,12 @@ static QPDF_ERROR_CODE trap_errors(qpdf_data qpdf, void (*fn)(qpdf_data))
|
||||
catch (std::runtime_error& e)
|
||||
{
|
||||
qpdf->error = new QPDFExc(qpdf_e_system, "", "", 0, e.what());
|
||||
status |= QPDF_ERRORS;
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
qpdf->error = new QPDFExc(qpdf_e_internal, "", "", 0, e.what());
|
||||
status |= QPDF_ERRORS;
|
||||
}
|
||||
|
||||
if (qpdf_more_warnings(qpdf))
|
||||
|
@ -830,7 +830,7 @@ my @encrypted_files =
|
||||
['long-password', 'asdf asdf asdf asdf asdf asdf qwer'],
|
||||
['long-password', 'asdf asdf asdf asdf asdf asdf qw']);
|
||||
|
||||
$n_tests += 3 + (2 * (@encrypted_files)) + (6 * (@encrypted_files - 3)) + 8;
|
||||
$n_tests += 3 + (2 * (@encrypted_files)) + (6 * (@encrypted_files - 3)) + 0;
|
||||
|
||||
$td->runtest("encrypted file",
|
||||
{$td->COMMAND => "test_driver 2 U25A0.pdf"},
|
||||
@ -952,6 +952,10 @@ $td->runtest("invalid password",
|
||||
{$td->STRING => "enc-R2,V1,U=view.pdf: invalid password\n",
|
||||
$td->EXIT_STATUS => 2},
|
||||
$td->NORMALIZE_NEWLINES);
|
||||
$td->runtest("C API: invalid password",
|
||||
{$td->COMMAND => "qpdf-ctest 2 enc-R2,V1,U=view.pdf '' a.qdf"},
|
||||
{$td->FILE => "c-invalid-password.out", $td->EXIT_STATUS => 0},
|
||||
$td->NORMALIZE_NEWLINES);
|
||||
|
||||
my @cenc = (
|
||||
[11, 'hybrid-xref.pdf', "''", 'r2', ""],
|
||||
|
5
qpdf/qtest/qpdf/c-invalid-password.out
Normal file
5
qpdf/qtest/qpdf/c-invalid-password.out
Normal file
@ -0,0 +1,5 @@
|
||||
error: enc-R2,V1,U=view.pdf: invalid password
|
||||
code: 4
|
||||
file: enc-R2,V1,U=view.pdf
|
||||
pos : 0
|
||||
text: invalid password
|
@ -1,3 +1,15 @@
|
||||
warning: append-page-content-damaged.pdf: file is damaged
|
||||
code: 5
|
||||
file: append-page-content-damaged.pdf
|
||||
pos : 0
|
||||
text: file is damaged
|
||||
warning: append-page-content-damaged.pdf: can't find startxref
|
||||
warning: Attempting to reconstruct cross-reference table
|
||||
code: 5
|
||||
file: append-page-content-damaged.pdf
|
||||
pos : 0
|
||||
text: can't find startxref
|
||||
warning: append-page-content-damaged.pdf: Attempting to reconstruct cross-reference table
|
||||
code: 5
|
||||
file: append-page-content-damaged.pdf
|
||||
pos : 0
|
||||
text: Attempting to reconstruct cross-reference table
|
||||
|
Loading…
x
Reference in New Issue
Block a user