summaryrefslogtreecommitdiff
path: root/src/mod_webdav.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mod_webdav.c')
-rw-r--r--src/mod_webdav.c51
1 files changed, 25 insertions, 26 deletions
diff --git a/src/mod_webdav.c b/src/mod_webdav.c
index e5799aa5..9efee4b5 100644
--- a/src/mod_webdav.c
+++ b/src/mod_webdav.c
@@ -23,17 +23,16 @@
#include <unistd.h>
#include <dirent.h>
-#if defined(HAVE_LIBXML_H) && defined(HAVE_SQLITE3_H)
-#define USE_PROPPATCH
+#if defined(WITH_XML) && defined(WITH_SQLITE3)
+#define WEBDAV_USE_PROPPATCH
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <sqlite3.h>
#endif
-#if defined(HAVE_LIBXML_H) && defined(HAVE_SQLITE3_H) \
- && defined(HAVE_UUID) && defined(HAVE_UUID_UUID_H)
-#define USE_LOCKS
+#if defined(WITH_XML) && defined(WITH_SQLITE3) && defined(WITH_UUID)
+#define WEBDAV_USE_LOCKS
#include <uuid/uuid.h>
#endif
@@ -56,7 +55,7 @@ typedef struct {
unsigned short log_xml;
buffer *sqlite_db_name;
-#ifdef USE_PROPPATCH
+#ifdef WEBDAV_USE_PROPPATCH
sqlite3 *sql;
sqlite3_stmt *stmt_update_prop;
sqlite3_stmt *stmt_delete_prop;
@@ -128,7 +127,7 @@ FREE_FUNC(mod_webdav_free) {
if (NULL == s) continue;
buffer_free(s->sqlite_db_name);
-#ifdef USE_PROPPATCH
+#ifdef WEBDAV_USE_PROPPATCH
if (s->sql) {
sqlite3_finalize(s->stmt_delete_prop);
sqlite3_finalize(s->stmt_delete_uri);
@@ -205,7 +204,7 @@ SETDEFAULTS_FUNC(mod_webdav_set_defaults) {
}
if (!buffer_string_is_empty(s->sqlite_db_name)) {
-#ifdef USE_PROPPATCH
+#ifdef WEBDAV_USE_PROPPATCH
const char *next_stmt;
char *err;
@@ -387,7 +386,7 @@ static int mod_webdav_patch_connection(server *srv, connection *con, plugin_data
PATCH_OPTION(is_readonly);
PATCH_OPTION(log_xml);
-#ifdef USE_PROPPATCH
+#ifdef WEBDAV_USE_PROPPATCH
PATCH_OPTION(sql);
PATCH_OPTION(stmt_update_prop);
PATCH_OPTION(stmt_delete_prop);
@@ -423,7 +422,7 @@ static int mod_webdav_patch_connection(server *srv, connection *con, plugin_data
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("webdav.log-xml"))) {
PATCH_OPTION(log_xml);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("webdav.sqlite-db-name"))) {
-#ifdef USE_PROPPATCH
+#ifdef WEBDAV_USE_PROPPATCH
PATCH_OPTION(sql);
PATCH_OPTION(stmt_update_prop);
PATCH_OPTION(stmt_delete_prop);
@@ -552,7 +551,7 @@ static int webdav_delete_file(server *srv, connection *con, handler_ctx *hctx, p
}
webdav_gen_response_status_tag(srv, con, dst, status, b);
} else {
-#ifdef USE_PROPPATCH
+#ifdef WEBDAV_USE_PROPPATCH
sqlite3_stmt *stmt = hctx->conf.stmt_delete_uri;
if (!stmt) {
@@ -630,7 +629,7 @@ static int webdav_delete_dir(server *srv, connection *con, handler_ctx *hctx, ph
webdav_gen_response_status_tag(srv, con, &d, status, b);
} else {
-#ifdef USE_PROPPATCH
+#ifdef WEBDAV_USE_PROPPATCH
sqlite3_stmt *stmt = hctx->conf.stmt_delete_uri;
if (stmt) {
@@ -728,7 +727,7 @@ static int webdav_copy_file(server *srv, connection *con, handler_ctx *hctx, phy
"close ", dst->path, "failed: ", strerror(errno));
}
-#ifdef USE_PROPPATCH
+#ifdef WEBDAV_USE_PROPPATCH
if (0 == status) {
/* copy worked fine, copy connected properties */
sqlite3_stmt *stmt = hctx->conf.stmt_copy_uri;
@@ -802,7 +801,7 @@ static int webdav_copy_dir(server *srv, connection *con, handler_ctx *hctx, phys
errno != EEXIST) {
/* WTH ? */
} else {
-#ifdef USE_PROPPATCH
+#ifdef WEBDAV_USE_PROPPATCH
sqlite3_stmt *stmt = hctx->conf.stmt_copy_uri;
if (0 != (status = webdav_copy_dir(srv, con, hctx, &s, &d, overwrite))) {
@@ -847,7 +846,7 @@ static int webdav_copy_dir(server *srv, connection *con, handler_ctx *hctx, phys
return status;
}
-#ifdef USE_LOCKS
+#ifdef WEBDAV_USE_LOCKS
static void webdav_activelock(buffer *b,
const buffer *locktoken, const char *lockscope, const char *locktype, int depth, int timeout) {
buffer_append_string_len(b, CONST_STR_LEN("<D:activelock>\n"));
@@ -985,7 +984,7 @@ static int webdav_get_live_property(server *srv, connection *con, handler_ctx *h
buffer_append_string_len(b, CONST_STR_LEN("</D:getetag>"));
buffer_reset(con->physical.etag);
found = 1;
- #ifdef USE_LOCKS
+ #ifdef WEBDAV_USE_LOCKS
} else if (0 == strcmp(prop_name, "lockdiscovery")) {
webdav_get_live_property_lockdiscovery(srv, con, hctx, dst, b);
found = 1;
@@ -1010,7 +1009,7 @@ static int webdav_get_property(server *srv, connection *con, handler_ctx *hctx,
return webdav_get_live_property(srv, con, hctx, dst, prop_name, b);
} else {
int found = 0;
-#ifdef USE_PROPPATCH
+#ifdef WEBDAV_USE_PROPPATCH
sqlite3_stmt *stmt = hctx->conf.stmt_select_prop;
if (stmt) {
@@ -1061,7 +1060,7 @@ static webdav_property live_properties[] = {
{ "DAV:", "getlastmodified" },
{ "DAV:", "resourcetype" },
/*{ "DAV:", "source" },*//*(not implemented)*/
- #ifdef USE_LOCKS
+ #ifdef WEBDAV_USE_LOCKS
{ "DAV:", "lockdiscovery" },
{ "DAV:", "supportedlock" },
#endif
@@ -1100,7 +1099,7 @@ static int webdav_get_props(server *srv, connection *con, handler_ctx *hctx, phy
return 0;
}
-#ifdef USE_PROPPATCH
+#ifdef WEBDAV_USE_PROPPATCH
static int webdav_parse_chunkqueue(server *srv, connection *con, handler_ctx *hctx, chunkqueue *cq, xmlDoc **ret_xml) {
xmlParserCtxtPtr ctxt;
xmlDoc *xml;
@@ -1210,7 +1209,7 @@ static int webdav_parse_chunkqueue(server *srv, connection *con, handler_ctx *hc
}
#endif
-#ifdef USE_LOCKS
+#ifdef WEBDAV_USE_LOCKS
static int webdav_lockdiscovery(server *srv, connection *con,
buffer *locktoken, const char *lockscope, const char *locktype, int depth) {
@@ -1246,7 +1245,7 @@ static int webdav_lockdiscovery(server *srv, connection *con,
static int webdav_has_lock(server *srv, connection *con, handler_ctx *hctx, buffer *uri) {
int has_lock = 1;
-#ifdef USE_LOCKS
+#ifdef WEBDAV_USE_LOCKS
data_string *ds;
UNUSED(srv);
@@ -1357,7 +1356,7 @@ SUBREQUEST_FUNC(mod_webdav_subrequest_handler_huge) {
return HANDLER_FINISHED;
}
-#ifdef USE_PROPPATCH
+#ifdef WEBDAV_USE_PROPPATCH
/* any special requests or just allprop ? */
if (con->request.content_length) {
xmlDocPtr xml;
@@ -2182,7 +2181,7 @@ SUBREQUEST_FUNC(mod_webdav_subrequest_handler_huge) {
/* try a rename */
if (0 == rename(con->physical.path->ptr, p->physical.path->ptr)) {
-#ifdef USE_PROPPATCH
+#ifdef WEBDAV_USE_PROPPATCH
sqlite3_stmt *stmt;
stmt = p->conf.stmt_move_uri;
@@ -2250,7 +2249,7 @@ SUBREQUEST_FUNC(mod_webdav_subrequest_handler_huge) {
return HANDLER_FINISHED;
}
-#ifdef USE_PROPPATCH
+#ifdef WEBDAV_USE_PROPPATCH
if (con->request.content_length) {
xmlDocPtr xml;
@@ -2418,7 +2417,7 @@ propmatch_cleanup:
return HANDLER_FINISHED;
}
-#ifdef USE_LOCKS
+#ifdef WEBDAV_USE_LOCKS
if (con->request.content_length) {
xmlDocPtr xml;
buffer *hdr_if = NULL;
@@ -2650,7 +2649,7 @@ propmatch_cleanup:
return HANDLER_FINISHED;
#endif
case HTTP_METHOD_UNLOCK:
-#ifdef USE_LOCKS
+#ifdef WEBDAV_USE_LOCKS
if (NULL != (ds = (data_string *)array_get_element(con->request.headers, "Lock-Token"))) {
buffer *locktoken = ds->value;
sqlite3_stmt *stmt = p->conf.stmt_remove_lock;