From 75b6425fe9ce8136dbc852415471708d365b4d25 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 19 Jan 2012 00:58:09 +0100 Subject: Remove confusing optional 'password' argument to pdf_open_xref. Require that clients call pdf_needs_password/pdf_authenticate_password instead. For dumb clients, we still allow for decrypting a file with a blank password without calling those functions. --- apps/pdfclean.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'apps/pdfclean.c') diff --git a/apps/pdfclean.c b/apps/pdfclean.c index 0f3474ce..82eb7c03 100644 --- a/apps/pdfclean.c +++ b/apps/pdfclean.c @@ -775,7 +775,10 @@ int main(int argc, char **argv) exit(1); } - xref = pdf_open_xref(ctx, infile, password); + xref = pdf_open_xref(ctx, infile); + if (pdf_needs_password(xref)) + if (!pdf_authenticate_password(xref, password)) + fz_throw(ctx, "cannot authenticate password: %s\n", infile); out = fopen(outfile, "wb"); if (!out) -- cgit v1.2.3