| 9465 | */ |
| 9466 | |
| 9467 | static void |
| 9468 | renew_subscription( |
| 9469 | cupsd_client_t *con, /* I - Client connection */ |
| 9470 | int sub_id) /* I - Subscription ID */ |
| 9471 | { |
| 9472 | http_status_t status; /* Policy status */ |
| 9473 | cupsd_subscription_t *sub; /* Subscription */ |
| 9474 | ipp_attribute_t *lease; /* notify-lease-duration */ |
| 9475 | |
| 9476 | |
| 9477 | cupsdLogMessage(CUPSD_LOG_DEBUG2, |
| 9478 | "renew_subscription(con=%p[%d], sub_id=%d)", |
| 9479 | (void *)con, con->number, sub_id); |
| 9480 | |
| 9481 | /* |
| 9482 | * Is the subscription ID valid? |
| 9483 | */ |
| 9484 | |
| 9485 | if ((sub = cupsdFindSubscription(sub_id)) == NULL) |
| 9486 | { |
| 9487 | /* |
| 9488 | * Bad subscription ID... |
| 9489 | */ |
| 9490 | |
| 9491 | send_ipp_status(con, IPP_NOT_FOUND, _("Subscription #%d does not exist."), |
| 9492 | sub_id); |
| 9493 | return; |
| 9494 | } |
| 9495 | |
| 9496 | if (sub->job) |
| 9497 | { |
| 9498 | /* |
| 9499 | * Job subscriptions cannot be renewed... |
| 9500 | */ |
| 9501 | |
| 9502 | send_ipp_status(con, IPP_NOT_POSSIBLE, |
| 9503 | _("Job subscriptions cannot be renewed.")); |
| 9504 | return; |
| 9505 | } |
| 9506 | |
| 9507 | /* |
| 9508 | * Check policy... |
| 9509 | */ |
| 9510 | |
| 9511 | if ((status = cupsdCheckPolicy(sub->dest ? sub->dest->op_policy_ptr : |
| 9512 | DefaultPolicyPtr, |
| 9513 | con, sub->owner)) != HTTP_OK) |
| 9514 | { |
| 9515 | send_http_error(con, status, sub->dest); |
| 9516 | return; |
| 9517 | } |
| 9518 | |
| 9519 | /* |
| 9520 | * Renew the subscription... |
| 9521 | */ |
| 9522 | |
| 9523 | _cupsRWLockWrite(&sub->lock); |
| 9524 |
no test coverage detected