diff --git a/cups-pk-helper-invalid-job.patch b/cups-pk-helper-invalid-job.patch new file mode 100644 index 0000000..c1904c3 --- /dev/null +++ b/cups-pk-helper-invalid-job.patch @@ -0,0 +1,115 @@ +--- cups-pk-helper-0.0.4/src/cups-pk-helper-mechanism.c.invalid-job 2010-02-23 13:21:27.000000000 +0100 ++++ cups-pk-helper-0.0.4/src/cups-pk-helper-mechanism.c 2010-02-23 13:33:08.000000000 +0100 +@@ -439,8 +439,11 @@ _cph_mechanism_return_error (CphMechanis + { + const char *error; + +- if (failed) ++ if (failed) { + error = cph_cups_last_status_to_string (mechanism->priv->cups); ++ if (!error || error[0] == '\0') ++ error = "Unknown error"; ++ } + else + error = ""; + +@@ -455,8 +458,11 @@ _cph_mechanism_return_error_and_value (C + { + const char *error; + +- if (failed) ++ if (failed) { + error = cph_cups_last_status_to_string (mechanism->priv->cups); ++ if (!error || error[0] == '\0') ++ error = "Unknown error"; ++ } + else + error = ""; + +@@ -996,18 +1002,25 @@ cph_mechanism_job_cancel (CphMechanism + case CPH_JOB_STATUS_OWNED_BY_USER: { + if (!_check_polkit_for_action_v (mechanism, context, + "job-edit", +- NULL)) ++ NULL)) { ++ g_free (user_name); + return FALSE; ++ } + break; + } + case CPH_JOB_STATUS_NOT_OWNED_BY_USER: { + if (!_check_polkit_for_action (mechanism, context, +- "job-not-owned-edit")) ++ "job-not-owned-edit")) { ++ g_free (user_name); + return FALSE; ++ } + break; + } +- case CPH_JOB_STATUS_INVALID: ++ case CPH_JOB_STATUS_INVALID: { ++ _cph_mechanism_return_error (mechanism, context, TRUE); ++ g_free (user_name); + return FALSE; ++ } + } + + ret = cph_cups_job_cancel (mechanism->priv->cups, id, user_name); +@@ -1037,18 +1050,25 @@ cph_mechanism_job_restart (CphMechanism + case CPH_JOB_STATUS_OWNED_BY_USER: { + if (!_check_polkit_for_action_v (mechanism, context, + "job-edit", +- NULL)) ++ NULL)) { ++ g_free (user_name); + return FALSE; ++ } + break; + } + case CPH_JOB_STATUS_NOT_OWNED_BY_USER: { + if (!_check_polkit_for_action (mechanism, context, +- "job-not-owned-edit")) ++ "job-not-owned-edit")) { ++ g_free (user_name); + return FALSE; ++ } + break; + } +- case CPH_JOB_STATUS_INVALID: ++ case CPH_JOB_STATUS_INVALID: { ++ _cph_mechanism_return_error (mechanism, context, TRUE); ++ g_free (user_name); + return FALSE; ++ } + } + + ret = cph_cups_job_restart (mechanism->priv->cups, id, user_name); +@@ -1079,18 +1099,25 @@ cph_mechanism_job_set_hold_until (CphMec + case CPH_JOB_STATUS_OWNED_BY_USER: { + if (!_check_polkit_for_action_v (mechanism, context, + "job-edit", +- NULL)) ++ NULL)) { ++ g_free (user_name); + return FALSE; ++ } + break; + } + case CPH_JOB_STATUS_NOT_OWNED_BY_USER: { + if (!_check_polkit_for_action (mechanism, context, +- "job-not-owned-edit")) ++ "job-not-owned-edit")) { ++ g_free (user_name); + return FALSE; ++ } + break; + } +- case CPH_JOB_STATUS_INVALID: ++ case CPH_JOB_STATUS_INVALID: { ++ _cph_mechanism_return_error (mechanism, context, TRUE); ++ g_free (user_name); + return FALSE; ++ } + } + + ret = cph_cups_job_set_hold_until (mechanism->priv->cups, id, job_hold_until, user_name); diff --git a/cups-pk-helper-job-status.patch b/cups-pk-helper-job-status.patch index cd55441..5158d20 100644 --- a/cups-pk-helper-job-status.patch +++ b/cups-pk-helper-job-status.patch @@ -1,5 +1,5 @@ ---- cups-pk-helper-0.0.4/src/cups.c.job-status 2010-02-23 12:11:17.000000000 +0100 -+++ cups-pk-helper-0.0.4/src/cups.c 2010-02-23 12:35:29.000000000 +0100 +--- cups-pk-helper-0.0.4/src/cups.c.job-status 2010-02-23 13:21:27.000000000 +0100 ++++ cups-pk-helper-0.0.4/src/cups.c 2010-02-23 13:21:27.000000000 +0100 @@ -1787,19 +1787,34 @@ cph_cups_job_get_status (CphCups *cup int job_id, const char *user) diff --git a/cups-pk-helper.spec b/cups-pk-helper.spec index 9cc893d..bd5b984 100644 --- a/cups-pk-helper.spec +++ b/cups-pk-helper.spec @@ -1,6 +1,6 @@ Name: cups-pk-helper Version: 0.0.4 -Release: 11%{?dist} +Release: 12%{?dist} Summary: A helper that makes system-config-printer use PolicyKit Group: System Environment/Base @@ -16,6 +16,7 @@ Patch4: cups-pk-helper-ppd-name.patch Patch5: allow_authentication.patch Patch6: cups-pk-helper-add-printer-ppd-optional.patch Patch7: cups-pk-helper-job-status.patch +Patch8: cups-pk-helper-invalid-job.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -53,6 +54,7 @@ interfaces available under control of PolicyKit. %patch5 -p1 -b .allow_auth %patch6 -p1 -b .ppd %patch7 -p1 -b .job-status +%patch8 -p1 -b .invalid-job %build # Patch0 modifies configure.ac @@ -82,6 +84,12 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Tue Feb 23 2010 Marek Kasik - 0.0.4-12 +- Avoid timeout on job-related methods for invalid jobs +- Make sure to return an error via dbus in case of failure +- Remove a small leak +- Resolves: #548790 + * Tue Feb 23 2010 Marek Kasik - 0.0.4-11 - Make cph_cups_job_get_status() efficient - Resolves: #548771