Commit bf255ccc896dc9cf54b13e0f60371f7429035b50
1 parent
21c897aa
QPDFJob: convert password in two tables
Showing
7 changed files
with
15 additions
and
21 deletions
generate_auto_job
include/qpdf/QPDFJob.hh
| @@ -178,6 +178,7 @@ class QPDFJob | @@ -178,6 +178,7 @@ class QPDFJob | ||
| 178 | QPDF_DLL Config& oiMinHeight(char const* parameter); | 178 | QPDF_DLL Config& oiMinHeight(char const* parameter); |
| 179 | QPDF_DLL Config& oiMinWidth(char const* parameter); | 179 | QPDF_DLL Config& oiMinWidth(char const* parameter); |
| 180 | QPDF_DLL Config& optimizeImages(); | 180 | QPDF_DLL Config& optimizeImages(); |
| 181 | + QPDF_DLL Config& password(char const* parameter); | ||
| 181 | QPDF_DLL Config& passwordIsHexKey(); | 182 | QPDF_DLL Config& passwordIsHexKey(); |
| 182 | QPDF_DLL Config& preserveUnreferenced(); | 183 | QPDF_DLL Config& preserveUnreferenced(); |
| 183 | QPDF_DLL Config& preserveUnreferencedResources(); | 184 | QPDF_DLL Config& preserveUnreferencedResources(); |
job.sums
| 1 | # Generated by generate_auto_job | 1 | # Generated by generate_auto_job |
| 2 | -generate_auto_job 8e2c467c47a66caef46497d96be461e7373e22124abe1bde3ef353bd99452609 | 2 | +generate_auto_job e18ae51cee2838fe44c37237a344fb48abe7a6d3f9cfa745d2f1dbc9c294e7b7 |
| 3 | job.yml 55d272cca0657e1f96ca92f5253edb6c6e24e6ea19e37690446d2111adc13f91 | 3 | job.yml 55d272cca0657e1f96ca92f5253edb6c6e24e6ea19e37690446d2111adc13f91 |
| 4 | -libqpdf/qpdf/auto_job_decl.hh ff9bbeec974f6a7e6ed2ba205e3d7f81fbe4f6224860a9ba37c30b817b951a90 | 4 | +libqpdf/qpdf/auto_job_decl.hh e9844137bf53345f2c6973378b314a2510ebce83ac8ceb378588cd6afdd87c06 |
| 5 | libqpdf/qpdf/auto_job_help.hh 383eea80e2c185ef5295fc126246457a7ceeffea759fdb90bb2e6727532ea538 | 5 | libqpdf/qpdf/auto_job_help.hh 383eea80e2c185ef5295fc126246457a7ceeffea759fdb90bb2e6727532ea538 |
| 6 | -libqpdf/qpdf/auto_job_init.hh 45e3d28708c7506a681477a7865fa39dcd10e93819875a8d5664d6629f6e5245 | 6 | +libqpdf/qpdf/auto_job_init.hh e65119793c329630aa243ff20907443f8eaf54c29d02737a598f29bba64b0bf5 |
| 7 | libqpdf/qpdf/auto_job_schema.hh c91a4e182e088797b70dda94af03ca32d360f3564890132da2a8bdc3c4432423 | 7 | libqpdf/qpdf/auto_job_schema.hh c91a4e182e088797b70dda94af03ca32d360f3564890132da2a8bdc3c4432423 |
| 8 | manual/_ext/qpdf.py 855fe12de5af7a10bb24be6ecc4d5dff4c84ac58cf388a13be6bbb394346a67d | 8 | manual/_ext/qpdf.py 855fe12de5af7a10bb24be6ecc4d5dff4c84ac58cf388a13be6bbb394346a67d |
| 9 | manual/cli.rst 68122ff8179c10df3fe6d577adde4973c346f7866ba9a511bab5a6e6f292a6f1 | 9 | manual/cli.rst 68122ff8179c10df3fe6d577adde4973c346f7866ba9a511bab5a6e6f292a6f1 |
libqpdf/QPDFJob_argv.cc
| @@ -186,12 +186,6 @@ ArgParser::argShowCrypto() | @@ -186,12 +186,6 @@ ArgParser::argShowCrypto() | ||
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | void | 188 | void |
| 189 | -ArgParser::argPassword(char* parameter) | ||
| 190 | -{ | ||
| 191 | - o.password = QUtil::make_shared_cstr(parameter); | ||
| 192 | -} | ||
| 193 | - | ||
| 194 | -void | ||
| 195 | ArgParser::argPasswordFile(char* parameter) | 189 | ArgParser::argPasswordFile(char* parameter) |
| 196 | { | 190 | { |
| 197 | std::list<std::string> lines; | 191 | std::list<std::string> lines; |
| @@ -895,13 +889,6 @@ ArgParser::argCopyAttPositional(char* arg) | @@ -895,13 +889,6 @@ ArgParser::argCopyAttPositional(char* arg) | ||
| 895 | } | 889 | } |
| 896 | 890 | ||
| 897 | void | 891 | void |
| 898 | -ArgParser::argCopyAttPassword(char* parameter) | ||
| 899 | -{ | ||
| 900 | - // QXXXQ @TRIVIAL | ||
| 901 | - c_copy_att->password(parameter); | ||
| 902 | -} | ||
| 903 | - | ||
| 904 | -void | ||
| 905 | ArgParser::argEndCopyAttachment() | 892 | ArgParser::argEndCopyAttachment() |
| 906 | { | 893 | { |
| 907 | c_copy_att->end(); | 894 | c_copy_att->end(); |
libqpdf/QPDFJob_config.cc
| @@ -299,6 +299,13 @@ QPDFJob::Config::optimizeImages() | @@ -299,6 +299,13 @@ QPDFJob::Config::optimizeImages() | ||
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | QPDFJob::Config& | 301 | QPDFJob::Config& |
| 302 | +QPDFJob::Config::password(char const* parameter) | ||
| 303 | +{ | ||
| 304 | + o.password = QUtil::make_shared_cstr(parameter); | ||
| 305 | + return *this; | ||
| 306 | +} | ||
| 307 | + | ||
| 308 | +QPDFJob::Config& | ||
| 302 | QPDFJob::Config::passwordIsHexKey() | 309 | QPDFJob::Config::passwordIsHexKey() |
| 303 | { | 310 | { |
| 304 | o.password_is_hex_key = true; | 311 | o.password_is_hex_key = true; |
| @@ -527,6 +534,8 @@ QPDFJob::CopyAttConfig::end() | @@ -527,6 +534,8 @@ QPDFJob::CopyAttConfig::end() | ||
| 527 | { | 534 | { |
| 528 | if (this->caf.path.empty()) | 535 | if (this->caf.path.empty()) |
| 529 | { | 536 | { |
| 537 | + // QXXXQ usage, json, and config exceptions need to be unified | ||
| 538 | + // in some fashion. | ||
| 530 | throw std::runtime_error("copy attachments: no path specified"); | 539 | throw std::runtime_error("copy attachments: no path specified"); |
| 531 | } | 540 | } |
| 532 | this->config.o.attachments_to_copy.push_back(this->caf); | 541 | this->config.o.attachments_to_copy.push_back(this->caf); |
libqpdf/qpdf/auto_job_decl.hh
| @@ -25,7 +25,6 @@ void argOverlay(); | @@ -25,7 +25,6 @@ void argOverlay(); | ||
| 25 | void argPages(); | 25 | void argPages(); |
| 26 | void argUnderlay(); | 26 | void argUnderlay(); |
| 27 | void argJobJsonFile(char *); | 27 | void argJobJsonFile(char *); |
| 28 | -void argPassword(char *); | ||
| 29 | void argPasswordFile(char *); | 28 | void argPasswordFile(char *); |
| 30 | void argRotate(char *); | 29 | void argRotate(char *); |
| 31 | void argShowObject(char *); | 30 | void argShowObject(char *); |
| @@ -75,5 +74,4 @@ void argAttMimetype(char *); | @@ -75,5 +74,4 @@ void argAttMimetype(char *); | ||
| 75 | void argAttDescription(char *); | 74 | void argAttDescription(char *); |
| 76 | void argEndAttachment(); | 75 | void argEndAttachment(); |
| 77 | void argCopyAttPositional(char*); | 76 | void argCopyAttPositional(char*); |
| 78 | -void argCopyAttPassword(char *); | ||
| 79 | void argEndCopyAttachment(); | 77 | void argEndCopyAttachment(); |
libqpdf/qpdf/auto_job_init.hh
| @@ -94,7 +94,7 @@ this->ap.addRequiredParameter("min-version", [this](char *x){c_main->minVersion( | @@ -94,7 +94,7 @@ this->ap.addRequiredParameter("min-version", [this](char *x){c_main->minVersion( | ||
| 94 | this->ap.addRequiredParameter("oi-min-area", [this](char *x){c_main->oiMinArea(x);}, "minimum"); | 94 | this->ap.addRequiredParameter("oi-min-area", [this](char *x){c_main->oiMinArea(x);}, "minimum"); |
| 95 | this->ap.addRequiredParameter("oi-min-height", [this](char *x){c_main->oiMinHeight(x);}, "minimum"); | 95 | this->ap.addRequiredParameter("oi-min-height", [this](char *x){c_main->oiMinHeight(x);}, "minimum"); |
| 96 | this->ap.addRequiredParameter("oi-min-width", [this](char *x){c_main->oiMinWidth(x);}, "minimum"); | 96 | this->ap.addRequiredParameter("oi-min-width", [this](char *x){c_main->oiMinWidth(x);}, "minimum"); |
| 97 | -this->ap.addRequiredParameter("password", p(&ArgParser::argPassword), "password"); | 97 | +this->ap.addRequiredParameter("password", [this](char *x){c_main->password(x);}, "password"); |
| 98 | this->ap.addRequiredParameter("password-file", p(&ArgParser::argPasswordFile), "password"); | 98 | this->ap.addRequiredParameter("password-file", p(&ArgParser::argPasswordFile), "password"); |
| 99 | this->ap.addRequiredParameter("remove-attachment", [this](char *x){c_main->removeAttachment(x);}, "attachment"); | 99 | this->ap.addRequiredParameter("remove-attachment", [this](char *x){c_main->removeAttachment(x);}, "attachment"); |
| 100 | this->ap.addRequiredParameter("rotate", p(&ArgParser::argRotate), "[+|-]angle"); | 100 | this->ap.addRequiredParameter("rotate", p(&ArgParser::argRotate), "[+|-]angle"); |
| @@ -153,7 +153,7 @@ this->ap.addRequiredParameter("description", p(&ArgParser::argAttDescription), " | @@ -153,7 +153,7 @@ this->ap.addRequiredParameter("description", p(&ArgParser::argAttDescription), " | ||
| 153 | this->ap.registerOptionTable("copy attachment", b(&ArgParser::argEndCopyAttachment)); | 153 | this->ap.registerOptionTable("copy attachment", b(&ArgParser::argEndCopyAttachment)); |
| 154 | this->ap.addPositional(p(&ArgParser::argCopyAttPositional)); | 154 | this->ap.addPositional(p(&ArgParser::argCopyAttPositional)); |
| 155 | this->ap.addRequiredParameter("prefix", [this](char *x){c_copy_att->prefix(x);}, "prefix"); | 155 | this->ap.addRequiredParameter("prefix", [this](char *x){c_copy_att->prefix(x);}, "prefix"); |
| 156 | -this->ap.addRequiredParameter("password", p(&ArgParser::argCopyAttPassword), "password"); | 156 | +this->ap.addRequiredParameter("password", [this](char *x){c_copy_att->password(x);}, "password"); |
| 157 | this->ap.selectOptionTable("256-bit encryption"); | 157 | this->ap.selectOptionTable("256-bit encryption"); |
| 158 | this->ap.copyFromOtherTable("cleartext-metadata", "128-bit encryption"); | 158 | this->ap.copyFromOtherTable("cleartext-metadata", "128-bit encryption"); |
| 159 | this->ap.copyFromOtherTable("accessibility", "128-bit encryption"); | 159 | this->ap.copyFromOtherTable("accessibility", "128-bit encryption"); |