| 743 | } |
| 744 | |
| 745 | DAV_DECLARE(dav_error *) dav_notify_created(request_rec *r, |
| 746 | dav_lockdb *lockdb, |
| 747 | const dav_resource *resource, |
| 748 | int resource_state, |
| 749 | int depth) |
| 750 | { |
| 751 | dav_error *err; |
| 752 | |
| 753 | if (resource_state == DAV_RESOURCE_LOCK_NULL) { |
| 754 | |
| 755 | /* |
| 756 | ** The resource is no longer a locknull resource. This will remove |
| 757 | ** the special marker. |
| 758 | ** |
| 759 | ** Note that a locknull resource has already inherited all of the |
| 760 | ** locks from the parent. We do not need to call dav_inherit_locks. |
| 761 | ** |
| 762 | ** NOTE: some lock providers record locks for locknull resources using |
| 763 | ** a different key than for regular resources. this will shift |
| 764 | ** the lock information between the two key types. |
| 765 | */ |
| 766 | (void)(*lockdb->hooks->remove_locknull_state)(lockdb, resource); |
| 767 | |
| 768 | /* |
| 769 | ** There are resources under this one, which are new. We must |
| 770 | ** propagate the locks down to the new resources. |
| 771 | */ |
| 772 | if (depth > 0 && |
| 773 | (err = dav_inherit_locks(r, lockdb, resource, 0)) != NULL) { |
| 774 | /* ### add a higher level desc? */ |
| 775 | return err; |
| 776 | } |
| 777 | } |
| 778 | else if (resource_state == DAV_RESOURCE_NULL) { |
| 779 | |
| 780 | /* ### should pass depth to dav_inherit_locks so that it can |
| 781 | ** ### optimize for the depth==0 case. |
| 782 | */ |
| 783 | |
| 784 | /* this resource should inherit locks from its parent */ |
| 785 | if ((err = dav_inherit_locks(r, lockdb, resource, 1)) != NULL) { |
| 786 | |
| 787 | err = dav_push_error(r->pool, err->status, 0, |
| 788 | "The resource was created successfully, but " |
| 789 | "there was a problem inheriting locks from " |
| 790 | "the parent resource.", |
| 791 | err); |
| 792 | return err; |
| 793 | } |
| 794 | } |
| 795 | /* else the resource already exists and its locks are correct. */ |
| 796 | |
| 797 | return NULL; |
| 798 | } |
no test coverage detected