libonion
|
#include <onion/handler.h>
Typedefs | |
typedef int(* | onion_webdav_permissions_check )(const char *exported_path, const char *file, onion_request *req) |
Typedef with the signature of the permission checker. |
Functions | |
onion_handler * | onion_handler_webdav (const char *path, onion_webdav_permissions_check) |
Exports the given path through webdav. | |
int | onion_webdav_default_check_permissions (const char *exported_path, const char *file, onion_request *req) |
Default permission checker. |
typedef int(* onion_webdav_permissions_check)(const char *exported_path, const char *file, onion_request *req) |
Typedef with the signature of the permission checker.
onion_handler* onion_handler_webdav | ( | const char * | path, |
onion_webdav_permissions_check | perm | ||
) |
Exports the given path through webdav.
Exports the given path through webdav.
The check_permissions parameter, if set, sets a custom security permission checker.
If not set, the default permissions apply, that will try to do not access files out of the restricted area.
This permission checker gets the exported path, the path to the file that wants to be exported/checked/moved.., and the request as it arrived to the handler.
The exported path and file path might be relative, if onion_handler_webdav was initialized so.
On move it will check for both the original and final files, on other methods, it will check just the file, and the semantics is that the user is allowed to do that method.
It should return 0 on success, any other if error/not allowed.
path | Path to share |
References onion_webdav_t::check_permissions, onion_handler_t::onion_handler_new(), onion_low_malloc(), onion_low_strdup(), onion_webdav_default_check_permissions(), onion_webdav_free(), onion_webdav_handler(), and onion_webdav_t::path.
int onion_webdav_default_check_permissions | ( | const char * | exported_path, |
const char * | filename, | ||
onion_request * | req | ||
) |
Default permission checker.
It checks the given path complies with the exported area.
References ONION_DEBUG0, ONION_ERROR, and onion_low_free().
Referenced by onion_handler_webdav().