MCPcopy Create free account
hub / github.com/apache/httpd / dav_prop_validate

Function dav_prop_validate

modules/dav/main/props.c:962–1051  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

960}
961
962DAV_DECLARE_NONSTD(void) dav_prop_validate(dav_prop_ctx *ctx)
963{
964 dav_propdb *propdb = ctx->propdb;
965 apr_xml_elem *prop = ctx->prop;
966 dav_elem_private *priv;
967
968 priv = ctx->prop->priv = apr_pcalloc(propdb->p, sizeof(*priv));
969
970 /*
971 ** Check to see if this is a live property, and fill the fields
972 ** in the XML elem, as appropriate.
973 **
974 ** Verify that the property is read/write. If not, then it cannot
975 ** be SET or DELETEd.
976 */
977 if (priv->propid == 0) {
978 dav_find_liveprop(propdb, prop);
979
980 /* it's a liveprop if a provider was found */
981 /* ### actually the "core" props should really be liveprops, but
982 ### there is no "provider" for those and the r/w props are
983 ### treated as dead props anyhow */
984 ctx->is_liveprop = priv->provider != NULL;
985 }
986
987 if (!dav_rw_liveprop(propdb, priv)) {
988 ctx->err = dav_new_error(propdb->p, HTTP_CONFLICT,
989 DAV_ERR_PROP_READONLY, 0,
990 "Property is read-only.");
991 return;
992 }
993
994 if (ctx->is_liveprop) {
995 int defer_to_dead = 0;
996
997 ctx->err = (*priv->provider->patch_validate)(propdb->resource,
998 prop, ctx->operation,
999 &ctx->liveprop_ctx,
1000 &defer_to_dead);
1001 if (ctx->err != NULL || !defer_to_dead)
1002 return;
1003
1004 /* clear is_liveprop -- act as a dead prop now */
1005 ctx->is_liveprop = 0;
1006 }
1007
1008 /*
1009 ** The property is supposed to be stored into the dead-property
1010 ** database. Make sure the thing is truly open (and writable).
1011 */
1012 if (propdb->deferred
1013 && (ctx->err = dav_really_open_db(propdb, 0 /* ro */)) != NULL) {
1014 return;
1015 }
1016
1017 /*
1018 ** There should be an open, writable database in here!
1019 **

Callers 2

dav_method_proppatchFunction · 0.85
mod_dav.hFile · 0.85

Calls 4

dav_find_livepropFunction · 0.85
dav_rw_livepropFunction · 0.85
dav_new_errorFunction · 0.85
dav_really_open_dbFunction · 0.85

Tested by

no test coverage detected