| 4130 | } dav_label_walker_ctx; |
| 4131 | |
| 4132 | static dav_error * dav_label_walker(dav_walk_resource *wres, int calltype) |
| 4133 | { |
| 4134 | dav_label_walker_ctx *ctx = wres->walk_ctx; |
| 4135 | dav_error *err = NULL; |
| 4136 | |
| 4137 | /* check for any method preconditions */ |
| 4138 | if (dav_run_method_precondition(ctx->r, NULL, wres->resource, NULL, &err) != DECLINED |
| 4139 | && err) { |
| 4140 | /* precondition failed, dropping through */ |
| 4141 | } |
| 4142 | |
| 4143 | /* Check the state of the resource: must be a version or |
| 4144 | * non-checkedout version selector |
| 4145 | */ |
| 4146 | /* ### need a general mechanism for reporting precondition violations |
| 4147 | * ### (should be returning XML document for 403/409 responses) |
| 4148 | */ |
| 4149 | else if (wres->resource->type != DAV_RESOURCE_TYPE_VERSION && |
| 4150 | (wres->resource->type != DAV_RESOURCE_TYPE_REGULAR |
| 4151 | || !wres->resource->versioned)) { |
| 4152 | err = dav_new_error(ctx->w.pool, HTTP_CONFLICT, 0, 0, |
| 4153 | "<DAV:must-be-version-or-version-selector/>"); |
| 4154 | } |
| 4155 | else if (wres->resource->working) { |
| 4156 | err = dav_new_error(ctx->w.pool, HTTP_CONFLICT, 0, 0, |
| 4157 | "<DAV:must-not-be-checked-out/>"); |
| 4158 | } |
| 4159 | else { |
| 4160 | /* do the label operation */ |
| 4161 | if (ctx->label_op == DAV_LABEL_REMOVE) |
| 4162 | err = (*ctx->vsn_hooks->remove_label)(wres->resource, ctx->label); |
| 4163 | else |
| 4164 | err = (*ctx->vsn_hooks->add_label)(wres->resource, ctx->label, |
| 4165 | ctx->label_op == DAV_LABEL_SET); |
| 4166 | } |
| 4167 | |
| 4168 | if (err != NULL) { |
| 4169 | /* ### need utility routine to add response with description? */ |
| 4170 | dav_add_response(wres, err->status, NULL); |
| 4171 | wres->response->desc = err->desc; |
| 4172 | } |
| 4173 | |
| 4174 | return NULL; |
| 4175 | } |
| 4176 | |
| 4177 | static int dav_method_label(request_rec *r) |
| 4178 | { |
nothing calls this directly
no test coverage detected