src/server/plugins/postgresql/webdav.c

branch
webdav
changeset 374
77506ec632a4
parent 372
1d2538a1ba8f
child 375
32b8017f5308
equal deleted inserted replaced
373:f78a585e1a2f 374:77506ec632a4
294 if(!resdata) { 294 if(!resdata) {
295 log_ereport(LOG_MISCONFIG, "postgresql webdav: resource pool %s not found", resource_pool); 295 log_ereport(LOG_MISCONFIG, "postgresql webdav: resource pool %s not found", resource_pool);
296 return NULL; 296 return NULL;
297 } 297 }
298 298
299 return pg_webdav_create_from_resdata(sn, rq, resdata); 299 return pg_webdav_create_from_resdata(sn, rq, repo, resdata);
300 } 300 }
301 301
302 WebdavBackend* pg_webdav_create_from_resdata(Session *sn, Request *rq, ResourceData *resdata) { 302 WebdavBackend* pg_webdav_create_from_resdata(Session *sn, Request *rq, PgRepository *repo, ResourceData *resdata) {
303 WebdavBackend *webdav = pool_malloc(sn->pool, sizeof(WebdavBackend)); 303 WebdavBackend *webdav = pool_malloc(sn->pool, sizeof(WebdavBackend));
304 if(!webdav) { 304 if(!webdav) {
305 return NULL; 305 return NULL;
306 } 306 }
307 *webdav = pg_webdav_backend; 307 *webdav = pg_webdav_backend;
313 } 313 }
314 webdav->instance = instance; 314 webdav->instance = instance;
315 315
316 instance->pg_resource = resdata; 316 instance->pg_resource = resdata;
317 instance->connection = resdata->data; 317 instance->connection = resdata->data;
318
319 instance->repository = repo;
320 snprintf(instance->root_resource_id_str, 32, "%" PRId64, repo->root_resource_id);
318 321
319 return webdav; 322 return webdav;
320 } 323 }
321 324
322 WebdavBackend* pg_webdav_prop_create(Session *sn, Request *rq, pblock *pb) { 325 WebdavBackend* pg_webdav_prop_create(Session *sn, Request *rq, pblock *pb) {
382 WSBool iscollection; 385 WSBool iscollection;
383 int res_errno = 0; 386 int res_errno = 0;
384 int err = pg_resolve_path( 387 int err = pg_resolve_path(
385 pgdav->connection, 388 pgdav->connection,
386 path, 389 path,
390 pgdav->root_resource_id_str,
387 &parent_id, 391 &parent_id,
388 &resource_id, 392 &resource_id,
389 NULL, // OID 393 NULL, // OID
390 &resourcename, 394 &resourcename,
391 &iscollection, 395 &iscollection,
867 WSBool iscollection; 871 WSBool iscollection;
868 int res_errno = 0; 872 int res_errno = 0;
869 int err = pg_resolve_path( 873 int err = pg_resolve_path(
870 pgdav->connection, 874 pgdav->connection,
871 path, 875 path,
876 pgdav->root_resource_id_str,
872 &parent_id, 877 &parent_id,
873 &resource_id, 878 &resource_id,
874 NULL, // OID 879 NULL, // OID
875 &resourcename, 880 &resourcename,
876 &iscollection, 881 &iscollection,

mercurial