]> granicus.if.org Git - apache/commitdiff
get the DAV stuff to compile for Apache 2.0. some unpleasantries are in
authorGreg Stein <gstein@apache.org>
Wed, 28 Jun 2000 11:23:53 +0000 (11:23 +0000)
committerGreg Stein <gstein@apache.org>
Wed, 28 Jun 2000 11:23:53 +0000 (11:23 +0000)
    there, but it *does* compile.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85720 13f79535-47bb-0310-9956-ffa450edef68

modules/dav/fs/dbm.c
modules/dav/fs/lock.c
modules/dav/fs/repos.c
modules/dav/fs/repos.h
modules/dav/main/mod_dav.c
modules/dav/main/mod_dav.h
modules/dav/main/props.c
modules/dav/main/util.c
modules/dav/main/util_lock.c
server/util_xml.c

index 77b9fc631a40ac4cf1396bd7b91a4f83e688cf60..fad6af3cc74258dbceaa0a68e4ef5eaa65d36e4a 100644 (file)
 #ifdef DAV_USE_GDBM
 #include <gdbm.h>
 #else
+
+/* ### need to APR-ize */
 #include <fcntl.h>             /* for O_RDONLY, O_WRONLY */
-#include "sdbm/sdbm.h"
+#include <sys/stat.h>           /* for S_IRUSR, etc */
+/* ### ACK! fix this... */
+#include "../../../lib/sdbm/sdbm.h"
 #endif
 
-#include "mod_dav.h"
-#include "dav_fs_repos.h"
+#include "../main/mod_dav.h"
+#include "repos.h"
 
 
 #ifdef DAV_USE_GDBM
@@ -107,14 +111,14 @@ typedef DBM *dav_dbm_file;
 #endif
 
 struct dav_db {
-    pool *pool;
+    ap_pool_t *pool;
     dav_dbm_file file;
 };
 
 #define D2G(d) (*(datum*)&(d))
 
 
-void dav_dbm_get_statefiles(pool *p, const char *fname,
+void dav_dbm_get_statefiles(ap_pool_t *p, const char *fname,
                            const char **state1, const char **state2)
 {
     char *work;
@@ -144,7 +148,7 @@ void dav_dbm_get_statefiles(pool *p, const char *fname,
 #endif
 }
 
-static dav_error * dav_fs_dbm_error(dav_db *db, pool *p)
+static dav_error * dav_fs_dbm_error(dav_db *db, ap_pool_t *p)
 {
     int save_errno = errno;
     int errcode;
@@ -172,20 +176,20 @@ static dav_error * dav_fs_dbm_error(dav_db *db, pool *p)
 
 /* ensure that our state subdirectory is present */
 /* ### does this belong here or in dav_fs_repos.c ?? */
-void dav_fs_ensure_state_dir(pool * p, const char *dirname)
+void dav_fs_ensure_state_dir(ap_pool_t * p, const char *dirname)
 {
     const char *pathname = ap_pstrcat(p, dirname, "/" DAV_FS_STATE_DIR, NULL);
 
     /* ### do we need to deal with the umask? */
 
     /* just try to make it, ignoring any resulting errors */
-    mkdir(pathname, DAV_FS_MODE_DIR);
+    (void) ap_make_dir(pathname, APR_OS_DEFAULT, p);
 }
 
 /* dav_dbm_open_direct:  Opens a *dbm database specified by path.
  *    ro = boolean read-only flag.
  */
-dav_error * dav_dbm_open_direct(pool *p, const char *pathname, int ro,
+dav_error * dav_dbm_open_direct(ap_pool_t *p, const char *pathname, int ro,
                                dav_db **pdb)
 {
     dav_dbm_file file;
@@ -221,8 +225,8 @@ dav_error * dav_dbm_open_direct(pool *p, const char *pathname, int ro,
     return NULL;
 }
 
-static dav_error * dav_dbm_open(pool * p, const dav_resource *resource, int ro,
-                               dav_db **pdb)
+static dav_error * dav_dbm_open(ap_pool_t * p, const dav_resource *resource,
+                                int ro, dav_db **pdb)
 {
     const char *dirpath;
     const char *fname;
index e18c6c6d1961f0c6d5027e668d9e2cf314ee2ad9..6e8f4ba2cedf1438ea828a7ae7b90fdb2985a4d7 100644 (file)
 ** DAV filesystem lock implementation
 */
 
+/* ### this stuff is temporary... need APR */
 #include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#ifndef O_BINARY
+#define O_BINARY (0)
+#endif
 
 #include "httpd.h"
 #include "http_log.h"
 
-#include "mod_dav.h"
-#include "dav_opaquelock.h"
-#include "dav_fs_repos.h"
+#include "../main/mod_dav.h"
+#include "../main/dav_opaquelock.h"
+#include "repos.h"
 
 
 /* ---------------------------------------------------------------
 
 
 /* ack. forward declare. */
-static dav_error * dav_fs_remove_locknull_member(pool *p,
+static dav_error * dav_fs_remove_locknull_member(ap_pool_t *p,
                                                 const char *filename,
                                                 dav_buffer *pbuf);
 
@@ -209,7 +215,7 @@ typedef struct dav_lock_indirect
 struct dav_lockdb_private
 {
     request_rec *r;                    /* for accessing the uuid state */
-    pool *pool;                                /* a pool to use */
+    ap_pool_t *pool;                   /* a pool to use */
     const char *lockdb_path;           /* where is the lock database? */
 
     int opened;                                /* we opened the database */
@@ -270,7 +276,7 @@ static dav_lock *dav_fs_alloc_lock(dav_lockdb *lockdb, dav_datum key,
 ** Parse an opaquelocktoken URI into a locktoken.
 */
 static dav_error * dav_fs_parse_locktoken(
-    pool *p,
+    ap_pool_t *p,
     const char *char_token,
     dav_locktoken **locktoken_p)
 {
@@ -301,7 +307,7 @@ static dav_error * dav_fs_parse_locktoken(
 ** Generate the URI for a locktoken
 */
 static const char *dav_fs_format_locktoken(
-    pool *p,
+    ap_pool_t *p,
     const dav_locktoken *locktoken)
 {
     const char *uuid_token = dav_format_opaquelocktoken(p, &locktoken->uuid);
@@ -406,7 +412,7 @@ static void dav_fs_close_lockdb(dav_lockdb *lockdb)
 **
 ** Given a pathname, build a DAV_TYPE_FNAME lock database key.
 */
-static dav_datum dav_fs_build_fname_key(pool *p, const char *pathname)
+static dav_datum dav_fs_build_fname_key(ap_pool_t *p, const char *pathname)
 {
     dav_datum key;
 
@@ -433,7 +439,7 @@ static dav_datum dav_fs_build_fname_key(pool *p, const char *pathname)
 **    (non-Win32 and file exists ):
 **       dav_datum->dvalue = inode, dev_major, dev_minor
 */
-static dav_datum dav_fs_build_key(pool *p, const dav_resource *resource)
+static dav_datum dav_fs_build_key(ap_pool_t *p, const dav_resource *resource)
 {
     const char *file = dav_fs_pathname(resource);
 #ifndef WIN32
@@ -805,7 +811,7 @@ static const char *dav_fs_get_supportedlock(void)
 ** dav_fs_load_locknull_list:  Returns a dav_buffer dump of the locknull file
 **    for the given directory.
 */
-static dav_error * dav_fs_load_locknull_list(pool *p, const char *dirpath,
+static dav_error * dav_fs_load_locknull_list(ap_pool_t *p, const char *dirpath,
                                             dav_buffer *pbuf) 
 {
     struct stat finfo;
@@ -855,7 +861,7 @@ static dav_error * dav_fs_load_locknull_list(pool *p, const char *dirpath,
 ** dav_fs_save_locknull_list:  Saves contents of pbuf into the
 **    locknull file for dirpath.
 */
-static dav_error * dav_fs_save_locknull_list(pool *p, const char *dirpath,
+static dav_error * dav_fs_save_locknull_list(ap_pool_t *p, const char *dirpath,
                                             dav_buffer *pbuf)
 {
     const char *pathname;
@@ -905,7 +911,7 @@ static dav_error * dav_fs_save_locknull_list(pool *p, const char *dirpath,
 ** dav_fs_remove_locknull_member:  Removes filename from the locknull list
 **    for directory path.
 */
-static dav_error * dav_fs_remove_locknull_member(pool *p, const char *filename,
+static dav_error * dav_fs_remove_locknull_member(ap_pool_t *p, const char *filename,
                                                 dav_buffer *pbuf)
 {
     dav_error *err;
@@ -968,7 +974,7 @@ static dav_error * dav_fs_add_locknull_state(
     const dav_resource *resource)
 {
     dav_buffer buf = { 0 };
-    pool *p = lockdb->info->pool;
+    ap_pool_t *p = lockdb->info->pool;
     const char *dirpath;
     const char *fname;
     dav_error *err;
@@ -1007,7 +1013,7 @@ static dav_error * dav_fs_remove_locknull_state(
 {
     dav_buffer buf = { 0 };
     dav_error *err;
-    pool *p = lockdb->info->pool;
+    ap_pool_t *p = lockdb->info->pool;
     const char *pathname = dav_fs_pathname(resource);
 
     if ((err = dav_fs_remove_locknull_member(p, pathname, &buf)) != NULL) {
@@ -1071,7 +1077,7 @@ static dav_error * dav_fs_get_locks(dav_lockdb *lockdb,
                                    int calltype,
                                    dav_lock **locks)
 {
-    pool *p = lockdb->info->pool;
+    ap_pool_t *p = lockdb->info->pool;
     dav_datum key;
     dav_error *err;
     dav_lock *lock = NULL;
@@ -1242,7 +1248,7 @@ static dav_error * dav_fs_append_locks(dav_lockdb *lockdb,
                                       int make_indirect,
                                       const dav_lock *lock)
 {
-    pool *p = lockdb->info->pool;
+    ap_pool_t *p = lockdb->info->pool;
     dav_error *err;
     dav_lock_indirect *ip;
     dav_lock_discovery *dp;
index f9a59935a044a7425213ee22f6b4cf27f514b420..6035e69a3e1923d1d89e69df9839d5e1055c7d40 100644 (file)
 
 #include <string.h>
 
+/* ### this stuff is temporary... need APR */
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#ifndef O_BINARY
+#define O_BINARY (0)
+#endif
+
 #include "httpd.h"
 #include "http_log.h"
 #include "http_protocol.h"     /* for ap_set_* (in dav_fs_set_headers) */
 #include "http_request.h"       /* for ap_update_mtime() */
 
-#include "mod_dav.h"
-#include "dav_fs_repos.h"
+#include "../main/mod_dav.h"
+#include "repos.h"
 
 
 /* to assist in debugging mod_dav's GET handling */
@@ -75,9 +83,9 @@
 
 /* context needed to identify a resource */
 struct dav_resource_private {
-    pool *pool;             /* memory storage pool associated with request */
+    ap_pool_t *pool;        /* memory storage pool associated with request */
     const char *pathname;   /* full pathname to resource */
-    struct stat finfo;      /* filesystem info */
+    ap_finfo_t finfo;       /* filesystem info */
 };
 
 /* private context for doing a filesystem walk */
@@ -172,7 +180,7 @@ static const dav_fs_liveprop_name dav_fs_props[] =
 
 /* define the dav_stream structure for our use */
 struct dav_stream {
-    pool *p;
+    ap_pool_t *p;
     int fd;
     const char *pathname;      /* we may need to remove it at close time */
 };
@@ -184,7 +192,7 @@ static dav_error * dav_fs_walk(dav_walker_ctx *wctx, int depth);
 **
 ** PRIVATE REPOSITORY FUNCTIONS
 */
-pool *dav_fs_pool(const dav_resource *resource)
+ap_pool_t *dav_fs_pool(const dav_resource *resource)
 {
     return resource->info->pool;
 }
@@ -268,7 +276,7 @@ static int dav_sync_write(int fd, const char *buf, ssize_t bufsize)
 
 static dav_error * dav_fs_copymove_file(
     int is_move,
-    pool * p,
+    ap_pool_t * p,
     const char *src,
     const char *dst,
     dav_buffer *pbuf)
@@ -383,13 +391,13 @@ static dav_error * dav_fs_copymove_file(
 /* ### need more buffers to replace the pool argument */
 static dav_error * dav_fs_copymove_state(
     int is_move,
-    pool * p,
+    ap_pool_t * p,
     const char *src_dir, const char *src_file,
     const char *dst_dir, const char *dst_file,
     dav_buffer *pbuf)
 {
-    struct stat src_finfo;     /* finfo for source file */
-    struct stat dst_state_finfo;       /* finfo for STATE directory */
+    ap_finfo_t src_finfo;      /* finfo for source file */
+    ap_finfo_t dst_state_finfo;        /* finfo for STATE directory */
     const char *src;
     const char *dst;
 
@@ -397,7 +405,7 @@ static dav_error * dav_fs_copymove_state(
     src = ap_pstrcat(p, src_dir, "/" DAV_FS_STATE_DIR "/", src_file, NULL);
 
     /* the source file doesn't exist */
-    if (stat(src, &src_finfo) != 0) {
+    if (ap_stat(&src_finfo, src, p) != 0) {
        return NULL;
     }
 
@@ -416,7 +424,7 @@ static dav_error * dav_fs_copymove_state(
     }
 
     /* get info about the state directory */
-    if (stat(dst, &dst_state_finfo) != 0) {
+    if (ap_stat(&dst_state_finfo, dst, p) != 0) {
        /* Ack! Where'd it go? */
        /* ### use something besides 500? */
        return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
@@ -424,7 +432,7 @@ static dav_error * dav_fs_copymove_state(
     }
 
     /* The mkdir() may have failed because a *file* exists there already */
-    if (!S_ISDIR(dst_state_finfo.st_mode)) {
+    if (dst_state_finfo.filetype != APR_DIR) {
        /* ### try to recover by deleting this file? (and mkdir again) */
        /* ### use something besides 500? */
        return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
@@ -435,6 +443,9 @@ static dav_error * dav_fs_copymove_state(
     dst = ap_pstrcat(p, dst, "/", dst_file, NULL);
 
     /* copy/move the file now */
+#if 0
+    /* ### need st_dev from APR */
+
     if (is_move && src_finfo.st_dev == dst_state_finfo.st_dev) {
        /* simple rename is possible since it is on the same device */
        if (rename(src, dst) != 0) {
@@ -443,7 +454,9 @@ static dav_error * dav_fs_copymove_state(
                                 "Could not move state file.");
        }
     }
-    else {
+    else
+#endif
+    {
        /* gotta copy (and delete) */
        return dav_fs_copymove_file(is_move, p, src, dst, pbuf);
     }
@@ -451,7 +464,7 @@ static dav_error * dav_fs_copymove_state(
     return NULL;
 }
 
-static dav_error *dav_fs_copymoveset(int is_move, pool *p,
+static dav_error *dav_fs_copymoveset(int is_move, ap_pool_t *p,
                                     const dav_resource *src,
                                     const dav_resource *dst,
                                     dav_buffer *pbuf)
@@ -509,7 +522,7 @@ static dav_error *dav_fs_copymoveset(int is_move, pool *p,
     return err;
 }
 
-static dav_error *dav_fs_deleteset(pool *p, const dav_resource *resource)
+static dav_error *dav_fs_deleteset(ap_pool_t *p, const dav_resource *resource)
 {
     const char *dirpath;
     const char *fname;
@@ -578,7 +591,8 @@ static dav_resource * dav_fs_get_resource(
     ctx->finfo = r->finfo;
 
     /* Preserve case on OSes which fold canonical filenames */
-#if MODULE_MAGIC_NUMBER_MAJOR > 19990320 || (MODULE_MAGIC_NUMBER_MAJOR == 19990320 && MODULE_MAGIC_NUMBER_MINOR >= 8)
+#if 0
+    /* ### not available in Apache 2.0 yet */
     filename = r->case_preserved_filename;
 #else
     filename = r->filename;
@@ -616,9 +630,9 @@ static dav_resource * dav_fs_get_resource(
        resource->uri = r->uri;
     }
 
-    if (r->finfo.st_mode != 0) {
+    if (r->finfo.protection != 0) {
         resource->exists = 1;
-        resource->collection = S_ISDIR(r->finfo.st_mode);
+        resource->collection = r->finfo.filetype == APR_DIR;
 
        /* unused info in the URL will indicate a null resource */
 
@@ -647,7 +661,7 @@ static dav_resource * dav_fs_get_resource(
 
            /* retain proper integrity across the structures */
            if (!resource->exists) {
-               ctx->finfo.st_mode = 0;
+               ctx->finfo.protection = 0;
            }
        }
     }
@@ -695,7 +709,7 @@ static dav_resource * dav_fs_get_parent_resource(const dav_resource *resource)
        parent_resource->uri = uri;
     }
 
-    if (stat(parent_ctx->pathname, &parent_ctx->finfo) == 0) {
+    if (ap_stat(&parent_ctx->finfo, parent_ctx->pathname, ctx->pool) == 0) {
         parent_resource->exists = 1;
     }
 
@@ -715,8 +729,8 @@ static int dav_fs_is_same_resource(
 #ifdef WIN32
     return stricmp(ctx1->pathname, ctx2->pathname) == 0;
 #else
-    if (ctx1->finfo.st_mode != 0)
-        return ctx1->finfo.st_ino == ctx2->finfo.st_ino;
+    if (ctx1->finfo.protection != 0)
+        return ctx1->finfo.inode == ctx2->finfo.inode;
     else
         return strcmp(ctx1->pathname, ctx2->pathname) == 0;
 #endif
@@ -746,7 +760,7 @@ static dav_error * dav_fs_open_stream(const dav_resource *resource,
                                      dav_stream_mode mode,
                                      dav_stream **stream)
 {
-    pool *p = resource->info->pool;
+    ap_pool_t *p = resource->info->pool;
     dav_stream *ds = ap_palloc(p, sizeof(*ds));
     int flags;
 
@@ -773,7 +787,11 @@ static dav_error * dav_fs_open_stream(const dav_resource *resource,
        return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
                             "An error occurred while opening a resource.");
     }
+
+    /* ### need to fix this */
+#if 0
     ap_note_cleanups_for_fd(p, ds->fd);
+#endif
 
     *stream = ds;
     return NULL;
@@ -781,7 +799,10 @@ static dav_error * dav_fs_open_stream(const dav_resource *resource,
 
 static dav_error * dav_fs_close_stream(dav_stream *stream, int commit)
 {
+    /* ### need to fix this */
+#if 0
     ap_kill_cleanups_for_fd(stream->p, stream->fd);
+#endif
     close(stream->fd);
 
     if (!commit) {
@@ -851,7 +872,7 @@ static dav_error * dav_fs_set_headers(request_rec *r,
        return NULL;
 
     /* make sure the proper mtime is in the request record */
-    ap_update_mtime(r, resource->info->finfo.st_mtime);
+    ap_update_mtime(r, resource->info->finfo.mtime);
 
     /* ### note that these use r->filename rather than <resource> */
     ap_set_last_modified(r);
@@ -861,7 +882,7 @@ static dav_error * dav_fs_set_headers(request_rec *r,
     ap_table_setn(r->headers_out, "Accept-Ranges", "bytes");
 
     /* set up the Content-Length header */
-    ap_set_content_length(r, resource->info->finfo.st_size);
+    ap_set_content_length(r, resource->info->finfo.size);
 
     /* ### how to set the content type? */
     /* ### until this is resolved, the Content-Type header is busted */
@@ -885,7 +906,7 @@ static void dav_fs_free_file(void *free_handle)
     /* nothing to free ... */
 }
 
-static dav_error * dav_fs_create_collection(pool *p, dav_resource *resource)
+static dav_error * dav_fs_create_collection(ap_pool_t *p, dav_resource *resource)
 {
     dav_resource_private *ctx = resource->info;
 
@@ -1071,10 +1092,14 @@ static dav_error * dav_fs_move_resource(
     }
 #endif
 
+#if 0
+    /* ### we need st_dev in ap_finfo_t */
+
     /* determine whether a simple rename will work.
      * Assume source exists, else we wouldn't get called.
      */
     if (dstinfo->finfo.st_mode != 0) {
+        /* ### APR does not expose the st_dev concept! */
        if (dstinfo->finfo.st_dev == srcinfo->finfo.st_dev) {
            /* target exists and is on the same device. */
            can_rename = 1;
@@ -1093,6 +1118,7 @@ static dav_error * dav_fs_move_resource(
            can_rename = 1;
        }
     }
+#endif
 
     /* if we can't simply renamed, then do it the hard way... */
     if (!can_rename) {
@@ -1329,7 +1355,7 @@ dav_error * dav_fs_walker(dav_fs_walker_context *fsctx, int depth)
        dav_buffer_place_mem(wctx->pool,
                             &fsctx->path1, ep->d_name, len + 1, 0);
 
-       if (lstat(fsctx->path1.buf, &fsctx->info1.finfo) != 0) {
+       if (ap_lstat(&fsctx->info1.finfo, fsctx->path1.buf, wctx->pool) != 0) {
            /* woah! where'd it go? */
            /* ### should have a better error here */
            err = dav_new_error(wctx->pool, HTTP_NOT_FOUND, 0, NULL);
@@ -1354,14 +1380,14 @@ dav_error * dav_fs_walker(dav_fs_walker_context *fsctx, int depth)
        fsctx->res1.uri = wctx->uri.buf;
 
        /* ### for now, only process regular files (e.g. skip symlinks) */
-       if (S_ISREG(fsctx->info1.finfo.st_mode)) {
+       if (fsctx->info1.finfo.filetype == APR_REG) {
            /* call the function for the specified dir + file */
            if ((err = (*wctx->func)(wctx, DAV_CALLTYPE_MEMBER)) != NULL) {
                /* ### maybe add a higher-level description? */
                break;
            }
        }
-       else if (S_ISDIR(fsctx->info1.finfo.st_mode)) {
+       else if (fsctx->info1.finfo.filetype == APR_DIR) {
            size_t save_path_len = fsctx->path1.cur_len;
            size_t save_uri_len = wctx->uri.cur_len;
            size_t save_path2_len = fsctx->path2.cur_len;
@@ -1602,14 +1628,14 @@ static const char *dav_fs_getetag(const dav_resource *resource)
     if (!resource->exists) 
        return ap_pstrdup(ctx->pool, "");
 
-    if (ctx->finfo.st_mode != 0) {
+    if (ctx->finfo.protection != 0) {
         return ap_psprintf(ctx->pool, "\"%lx-%lx-%lx\"",
-                          (unsigned long) ctx->finfo.st_ino,
-                          (unsigned long) ctx->finfo.st_size,
-                          (unsigned long) ctx->finfo.st_mtime);
+                          (unsigned long) ctx->finfo.inode,
+                          (unsigned long) ctx->finfo.size,
+                          (unsigned long) ctx->finfo.mtime);
     }
 
-    return ap_psprintf(ctx->pool, "\"%lx\"", (unsigned long) ctx->finfo.st_mtime);
+    return ap_psprintf(ctx->pool, "\"%lx\"", (unsigned long) ctx->finfo.mtime);
 }
 
 static const dav_hooks_repository dav_hooks_repository_fs =
@@ -1671,7 +1697,7 @@ static dav_prop_insert dav_fs_insert_prop(const dav_resource *resource,
     const char *value;
     const char *s;
     dav_prop_insert which;
-    pool *p = resource->info->pool;
+    ap_pool_t *p = resource->info->pool;
     const dav_fs_liveprop_name *scan;
     int ns;
 
@@ -1705,7 +1731,7 @@ static dav_prop_insert dav_fs_insert_prop(const dav_resource *resource,
        ** create the file), then we should be pretty safe here.
        */
        dav_format_time(DAV_STYLE_ISO8601,
-                        resource->info->finfo.st_ctime,
+                        resource->info->finfo.ctime,
                         buf);
        value = buf;
        break;
@@ -1715,7 +1741,7 @@ static dav_prop_insert dav_fs_insert_prop(const dav_resource *resource,
        if (resource->collection)
            return DAV_PROP_INSERT_NOTDEF;
 
-       (void) sprintf(buf, "%ld", resource->info->finfo.st_size);
+       (void) sprintf(buf, "%ld", resource->info->finfo.size);
        value = buf;
        break;
 
@@ -1725,7 +1751,7 @@ static dav_prop_insert dav_fs_insert_prop(const dav_resource *resource,
 
     case DAV_PROPID_FS_getlastmodified:
        dav_format_time(DAV_STYLE_RFC822,
-                        resource->info->finfo.st_mtime,
+                        resource->info->finfo.mtime,
                         buf);
        value = buf;
        break;
@@ -1740,7 +1766,7 @@ static dav_prop_insert dav_fs_insert_prop(const dav_resource *resource,
            return DAV_PROP_INSERT_NOTDEF;
 
        /* the files are "ours" so we only need to check owner exec privs */
-       if (resource->info->finfo.st_mode & DAV_FS_MODE_XUSR)
+       if (resource->info->finfo.protection & APR_UEXECUTE)
            value = "T";
        else
            value = "F";
@@ -1908,8 +1934,8 @@ static dav_error *dav_fs_patch_exec(dav_resource *resource,
                                    dav_liveprop_rollback **rollback_ctx)
 {
     int value = context != NULL;
-    mode_t mode = resource->info->finfo.st_mode;
-    int old_value = (resource->info->finfo.st_mode & DAV_FS_MODE_XUSR) != 0;
+    ap_fileperms_t perms = resource->info->finfo.protection;
+    int old_value = (perms & APR_UEXECUTE) != 0;
 
     /* assert: prop == executable. operation == SET. */
 
@@ -1917,19 +1943,22 @@ static dav_error *dav_fs_patch_exec(dav_resource *resource,
     if (value == old_value)
        return NULL;
 
-    mode &= ~DAV_FS_MODE_XUSR;
+    perms &= ~APR_UEXECUTE;
     if (value)
-       mode |= DAV_FS_MODE_XUSR;
+       perms |= APR_UEXECUTE;
 
+#if 0
+    /* ### crap... APR does not have a chmod() ... skip for now. */
     if (chmod(resource->info->pathname, mode) == -1) {
        return dav_new_error(resource->info->pool,
                             HTTP_INTERNAL_SERVER_ERROR, 0,
                             "Could not set the executable flag of the "
                             "target resource.");
     }
+#endif
 
     /* update the resource and set up the rollback context */
-    resource->info->finfo.st_mode = mode;
+    resource->info->finfo.protection = perms;
     *rollback_ctx = (dav_liveprop_rollback *)old_value;
 
     return NULL;
@@ -1948,24 +1977,27 @@ static dav_error *dav_fs_patch_rollback(dav_resource *resource,
                                        void *context,
                                        dav_liveprop_rollback *rollback_ctx)
 {
-    mode_t mode = resource->info->finfo.st_mode & ~DAV_FS_MODE_XUSR;
+    ap_fileperms_t perms = resource->info->finfo.protection & ~APR_UEXECUTE;
     int value = rollback_ctx != NULL;
 
     /* assert: prop == executable. operation == SET. */
 
     /* restore the executable bit */
     if (value)
-       mode |= DAV_FS_MODE_XUSR;
+       perms |= APR_UEXECUTE;
 
+#if 0
+    /* ### crap... APR does not have a chmod() ... skip for now. */
     if (chmod(resource->info->pathname, mode) == -1) {
        return dav_new_error(resource->info->pool,
                             HTTP_INTERNAL_SERVER_ERROR, 0,
                             "After a failure occurred, the resource's "
                             "executable flag could not be restored.");
     }
+#endif
 
     /* restore the resource's state */
-    resource->info->finfo.st_mode = mode;
+    resource->info->finfo.protection = perms;
 
     return NULL;
 }
index 9f7fef7efe0fc4a5a6a30612e768f27a1f7f964a..a4cdeb5c9853dafa562c2163da457be3b2f7a442 100644 (file)
@@ -85,10 +85,10 @@ typedef int ssize_t;
 #endif /* WIN32 */
 
 /* ensure that our state subdirectory is present */
-void dav_fs_ensure_state_dir(pool *p, const char *dirname);
+void dav_fs_ensure_state_dir(ap_pool_t *p, const char *dirname);
 
 /* return the storage pool associated with a resource */
-pool *dav_fs_pool(const dav_resource *resource);
+ap_pool_t *dav_fs_pool(const dav_resource *resource);
 
 /* return the full pathname for a resource */
 const char *dav_fs_pathname(const dav_resource *resource);
@@ -106,9 +106,9 @@ dav_error * dav_fs_get_locknull_members(const dav_resource *resource,
 /* DBM functions used by the repository and locking providers */
 extern const dav_hooks_db dav_hooks_db_dbm;
 
-dav_error * dav_dbm_open_direct(pool *p, const char *pathname, int ro,
+dav_error * dav_dbm_open_direct(ap_pool_t *p, const char *pathname, int ro,
                                dav_db **pdb);
-void dav_dbm_get_statefiles(pool *p, const char *fname,
+void dav_dbm_get_statefiles(ap_pool_t *p, const char *fname,
                            const char **state1, const char **state2);
 
 
index cf8d745eb3be8d3659de4441a9c5369f50cb0daa..4853c4039162b6e57ad1264020ff59dbfdc97994 100644 (file)
@@ -109,7 +109,7 @@ typedef struct {
     int allow_depthinfinity;
     long limit_xml_body;
 
-    table *d_params;           /* per-directory DAV config parameters */
+    ap_table_t *d_params;      /* per-directory DAV config parameters */
     struct dav_dyn_mod_ctx *dmc;
 
     dav_dyn_hooks propdb;
@@ -139,7 +139,7 @@ typedef struct {
 extern module MODULE_VAR_EXPORT dav_module;
 
 /* copy a module's providers into our per-directory configuration state */
-static void dav_copy_providers(pool *p, const char *name, dav_dir_conf *conf)
+static void dav_copy_providers(ap_pool_t *p, const char *name, dav_dir_conf *conf)
 {
     const dav_dyn_module *mod;
     const dav_dyn_provider *provider;
@@ -202,16 +202,17 @@ static void dav_copy_providers(pool *p, const char *name, dav_dir_conf *conf)
     }
 }
 
-static void dav_init_handler(server_rec *s, pool *p)
+static void dav_init_handler(ap_pool_t *p, ap_pool_t *plog, ap_pool_t *ptemp,
+                             server_rec *s)
 {
     /* DBG0("dav_init_handler"); */
 
-    ap_add_version_component("DAV/" DAV_VERSION);
+    ap_add_version_component(p, "DAV/" DAV_VERSION);
 
     dav_process_builtin_modules(p);
 }
 
-static void *dav_create_server_config(pool *p, server_rec *s)
+static void *dav_create_server_config(ap_pool_t *p, server_rec *s)
 {
     dav_server_conf *newconf;
 
@@ -223,7 +224,7 @@ static void *dav_create_server_config(pool *p, server_rec *s)
     return newconf;
 }
 
-static void *dav_merge_server_config(pool *p, void *base, void *overrides)
+static void *dav_merge_server_config(ap_pool_t *p, void *base, void *overrides)
 {
     dav_server_conf *parent = base;
     dav_server_conf *child = overrides;
@@ -238,7 +239,7 @@ static void *dav_merge_server_config(pool *p, void *base, void *overrides)
     return newconf;
 }
 
-static void *dav_create_dir_config(pool *p, char *dir)
+static void *dav_create_dir_config(ap_pool_t *p, char *dir)
 {
     /* NOTE: dir==NULL creates the default per-dir config */
 
@@ -260,7 +261,7 @@ static void *dav_create_dir_config(pool *p, char *dir)
     return conf;
 }
 
-static void *dav_merge_dir_config(pool *p, void *base, void *overrides)
+static void *dav_merge_dir_config(ap_pool_t *p, void *base, void *overrides)
 {
     dav_dir_conf *parent = base;
     dav_dir_conf *child = overrides;
@@ -332,7 +333,7 @@ const char *dav_get_lockdb_path(const request_rec *r)
     return conf->lockdb_path;
 }
 
-table *dav_get_dir_params(const request_rec *r)
+ap_table_t *dav_get_dir_params(const request_rec *r)
 {
     dav_dir_conf *conf;
 
@@ -505,9 +506,6 @@ static int dav_error_response(request_rec *r, int status, const char *body)
     /* begin the response now... */
     ap_send_http_header(r);
 
-    /* ### hard or soft? */
-    ap_soft_timeout("send error body", r);
-
     ap_rvputs(r,
              DAV_RESPONSE_BODY_1,
              r->status_line,
@@ -521,8 +519,6 @@ static int dav_error_response(request_rec *r, int status, const char *body)
     ap_rputs(ap_psignature("\n<P><HR>\n", r), r);
     ap_rputs(DAV_RESPONSE_BODY_4, r);
 
-    ap_kill_timeout(r);
-
     /* the response has been sent. */
     /*
      * ### Use of DONE obviates logging..!
@@ -535,7 +531,7 @@ static int dav_error_response(request_rec *r, int status, const char *body)
 ** in a URI (to form a query section). We must explicitly handle it so that
 ** we can embed the URI into an XML document.
 */
-static const char *dav_xml_escape_uri(pool *p, const char *uri)
+static const char *dav_xml_escape_uri(ap_pool_t *p, const char *uri)
 {
     const char *e_uri = ap_escape_uri(p, uri);
 
@@ -554,7 +550,7 @@ static const char *dav_xml_escape_uri(pool *p, const char *uri)
 
 static void dav_send_multistatus(request_rec *r, int status,
                                  dav_response *first,
-                                array_header *namespaces)
+                                ap_array_header_t *namespaces)
 {
     /* Set the correct status and Content-Type */
     r->status = status;
@@ -563,9 +559,6 @@ static void dav_send_multistatus(request_rec *r, int status,
     /* Send all of the headers now */
     ap_send_http_header(r);
 
-    /* Start a timeout for delivering the response. */
-    ap_soft_timeout("sending multistatus response", r);
-
     /* Send the actual multistatus response now... */
     ap_rputs(DAV_XML_HEADER DEBUG_CR
             "<D:multistatus xmlns:D=\"DAV:\"", r);
@@ -627,9 +620,6 @@ static void dav_send_multistatus(request_rec *r, int status,
     }
 
     ap_rputs("</D:multistatus>" DEBUG_CR, r);
-
-    /* Done with sending and the timeout. */
-    ap_kill_timeout(r);
 }
 
 /*
@@ -648,11 +638,11 @@ static void dav_log_err(request_rec *r, dav_error *err, int level)
            continue;
        if (errscan->save_errno != 0) {
            errno = errscan->save_errno;
-           ap_log_rerror(APLOG_MARK, level, r, "%s  [%d, #%d]",
+           ap_log_rerror(APLOG_MARK, level, errno, r, "%s  [%d, #%d]",
                          errscan->desc, errscan->status, errscan->error_id);
        }
        else {
-           ap_log_rerror(APLOG_MARK, level | APLOG_NOERRNO, r,
+           ap_log_rerror(APLOG_MARK, level | APLOG_NOERRNO, 0, r,
                          "%s  [%d, #%d]",
                          errscan->desc, errscan->status, errscan->error_id);
        }
@@ -748,7 +738,7 @@ int dav_get_depth(request_rec *r, int def_depth)
 
     /* The caller will return an HTTP_BAD_REQUEST. This will augment the
      * default message that Apache provides. */
-    ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r,
+    ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r,
                  "An invalid Depth header was specified.");
     return -1;
 }
@@ -770,7 +760,7 @@ static int dav_get_overwrite(request_rec *r)
 
     /* The caller will return an HTTP_BAD_REQUEST. This will augment the
      * default message that Apache provides. */
-    ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r,
+    ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r,
                  "An invalid Overwrite header was specified.");
     return -1;
 }
@@ -788,7 +778,7 @@ static int dav_get_resource(request_rec *r, dav_resource **res_p)
     repos_hooks = DAV_AS_HOOKS_REPOSITORY(&conf->repository);
     if (repos_hooks == NULL || repos_hooks->get_resource == NULL) {
        /* ### this should happen at startup rather than per-request */
-       ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r,
+       ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r,
                       "No %s has been configured.",
                       repos_hooks == NULL
                       ? "repository module"
@@ -997,9 +987,6 @@ static int dav_method_get(request_rec *r)
        /* all set. send the headers now. */
        ap_send_http_header(r);
 
-       /* start a timeout for delivering the response. */
-       ap_soft_timeout("sending GET response", r);
-
        buffer = ap_palloc(r->pool, DAV_READ_BLOCKSIZE);
        while (1) {
            size_t amt;
@@ -1031,14 +1018,8 @@ static int dav_method_get(request_rec *r)
                 if (range_start > range_end)
                     break;
             }
-
-           /* reset the timeout after a successful write */
-           ap_reset_timeout(r);
        }
 
-       /* Done with the request; clear its timeout */
-       ap_kill_timeout(r);
-
        if (err != NULL)
            return dav_handle_err(r, err, NULL);
 
@@ -1342,13 +1323,13 @@ static int dav_method_delete(request_rec *r)
 
     if (resource->collection && depth != DAV_INFINITY) {
        /* This supplies additional information for the default message. */
-       ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r,
+       ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r,
                      "Depth must be \"infinity\" for DELETE of a collection.");
        return HTTP_BAD_REQUEST;
     }
     if (!resource->collection && depth == 1) {
        /* This supplies additional information for the default message. */
-       ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r,
+       ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r,
                      "Depth of \"1\" is not allowed for DELETE.");
        return HTTP_BAD_REQUEST;
     }
@@ -1705,7 +1686,7 @@ static int dav_method_propfind(request_rec *r)
 
     if (doc && !dav_validate_root(doc, "propfind")) {
        /* This supplies additional information for the default message. */
-       ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r,
+       ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r,
                      "The \"propfind\" element was not found.");
        return HTTP_BAD_REQUEST;
     }
@@ -1727,7 +1708,7 @@ static int dav_method_propfind(request_rec *r)
        /* "propfind" element must have one of the above three children */
 
        /* This supplies additional information for the default message. */
-       ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r,
+       ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r,
                      "The \"propfind\" element does not contain one of "
                      "the required child elements (the specific command).");
        return HTTP_BAD_REQUEST;
@@ -1786,7 +1767,8 @@ static int dav_method_propfind(request_rec *r)
     return DONE;
 }
 
-static dav_text * dav_failed_proppatch(pool *p, array_header *prop_ctx)
+static dav_text * dav_failed_proppatch(ap_pool_t *p,
+                                       ap_array_header_t *prop_ctx)
 {
     dav_text_header hdr = { 0 };
     int i = prop_ctx->nelts;
@@ -1846,7 +1828,7 @@ static dav_text * dav_failed_proppatch(pool *p, array_header *prop_ctx)
     return hdr.first;
 }
 
-static dav_text * dav_success_proppatch(pool *p, array_header *prop_ctx)
+static dav_text * dav_success_proppatch(ap_pool_t *p, ap_array_header_t *prop_ctx)
 {
     dav_text_header hdr = { 0 };
     int i = prop_ctx->nelts;
@@ -1889,7 +1871,7 @@ static void dav_prop_log_errors(dav_prop_ctx *ctx)
 ** reverse order.
 */
 static int dav_process_ctx_list(void (*func)(dav_prop_ctx *ctx),
-                               array_header *ctx_list, int stop_on_error,
+                               ap_array_header_t *ctx_list, int stop_on_error,
                                int reverse)
 {
     int i = ctx_list->nelts;
@@ -1926,7 +1908,7 @@ static int dav_method_proppatch(request_rec *r)
     int failure = 0;
     dav_response resp = { 0 };
     dav_text *propstat_text;
-    array_header *ctx_list;
+    ap_array_header_t *ctx_list;
     dav_prop_ctx *ctx;
 
     /* Ask repository module to resolve the resource */
@@ -1945,7 +1927,7 @@ static int dav_method_proppatch(request_rec *r)
 
     if (doc == NULL || !dav_validate_root(doc, "propertyupdate")) {
        /* This supplies additional information for the default message. */
-       ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r,
+       ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r,
                      "The request body does not contain "
                      "a \"propertyupdate\" element.");
        return HTTP_BAD_REQUEST;
@@ -1994,7 +1976,7 @@ static int dav_method_proppatch(request_rec *r)
            dav_close_propdb(propdb);
 
            /* This supplies additional information for the default message. */
-           ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r,
+           ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r,
                          "A \"prop\" element is missing inside "
                          "the propertyupdate command.");
            return HTTP_BAD_REQUEST;
@@ -2070,7 +2052,7 @@ static int process_mkcol_body(request_rec *r)
     if (tenc) {
        if (strcasecmp(tenc, "chunked")) {
            /* Use this instead of Apache's default error string */
-           ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r,
+           ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r,
                          "Unknown Transfer-Encoding %s", tenc);
            return HTTP_NOT_IMPLEMENTED;
        }
@@ -2085,7 +2067,7 @@ static int process_mkcol_body(request_rec *r)
        }
        if (*pos != '\0') {
            /* This supplies additional information for the default message. */
-           ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r,
+           ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r,
                          "Invalid Content-Length %s", lenp);
            return HTTP_BAD_REQUEST;
        }
@@ -2282,7 +2264,7 @@ static int dav_method_copymove(request_rec *r, int is_move)
     }
     if (dest == NULL) {
        /* This supplies additional information for the default message. */
-       ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r,
+       ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r,
                      "The request is missing a Destination header.");
        return HTTP_BAD_REQUEST;
     }
@@ -2291,7 +2273,7 @@ static int dav_method_copymove(request_rec *r, int is_move)
     if (lookup.rnew == NULL) {
        if (lookup.err.status == HTTP_BAD_REQUEST) {
            /* This supplies additional information for the default message. */
-           ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r,
+           ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r,
                          lookup.err.desc);
            return HTTP_BAD_REQUEST;
        }
@@ -2355,13 +2337,13 @@ static int dav_method_copymove(request_rec *r, int is_move)
     }
     if (depth == 1) {
        /* This supplies additional information for the default message. */
-       ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r,
+       ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r,
                   "Depth must be \"0\" or \"infinity\" for COPY or MOVE.");
        return HTTP_BAD_REQUEST;
     }
     if (is_move && is_dir && depth != DAV_INFINITY) {
        /* This supplies additional information for the default message. */
-       ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r,
+       ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r,
                    "Depth must be \"infinity\" when moving a collection.");
        return HTTP_BAD_REQUEST;
     }
@@ -2633,7 +2615,7 @@ static int dav_method_lock(request_rec *r)
 
     depth = dav_get_depth(r, DAV_INFINITY);
     if (depth != 0 && depth != DAV_INFINITY) {
-       ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r,
+       ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r,
                      "Depth must be 0 or \"infinity\" for LOCK.");
        return HTTP_BAD_REQUEST;
     }
@@ -2660,7 +2642,7 @@ static int dav_method_lock(request_rec *r)
         }
         new_lock_request = 1;
 
-        lock->auth_user = ap_pstrdup(r->pool, r->connection->user);
+        lock->auth_user = ap_pstrdup(r->pool, r->user);
     }
 
     resource_state = dav_get_resource_state(r, resource);
@@ -2749,7 +2731,6 @@ static int dav_method_lock(request_rec *r)
     r->content_type = DAV_XML_CONTENT_TYPE;
 
     ap_send_http_header(r);
-    ap_soft_timeout("send LOCK response", r);
 
     ap_rputs(DAV_XML_HEADER DEBUG_CR "<D:prop xmlns:D=\"DAV:\">" DEBUG_CR, r);
     if (lock == NULL)
@@ -2763,8 +2744,6 @@ static int dav_method_lock(request_rec *r)
     }
     ap_rputs("</D:prop>", r);
 
-    ap_kill_timeout(r);
-
     /* the response has been sent. */
     return DONE;
 
@@ -2794,7 +2773,7 @@ static int dav_method_unlock(request_rec *r)
         return DECLINED;
 
     if ((const_locktoken_txt = ap_table_get(r->headers_in, "Lock-Token")) == NULL) {
-       ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r,
+       ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r,
                      "Unlock failed (%s):  No Lock-Token specified in header", r->filename);
        return HTTP_BAD_REQUEST;
     }
@@ -3265,6 +3244,11 @@ static int dav_type_checker(request_rec *r)
     return DECLINED;
 }
 
+static void register_hooks(void)
+{
+    ap_hook_post_config(dav_init_handler, NULL, NULL, AP_HOOK_MIDDLE);
+    ap_hook_type_checker(dav_type_checker, NULL, NULL, AP_HOOK_MIDDLE);
+}
 
 /*---------------------------------------------------------------------------
 **
@@ -3332,23 +3316,12 @@ static const handler_rec dav_handlers[] =
 
 module MODULE_VAR_EXPORT dav_module =
 {
-    STANDARD_MODULE_STUFF,
-    dav_init_handler,          /* initializer */
+    STANDARD20_MODULE_STUFF,
     dav_create_dir_config,     /* dir config creater */
     dav_merge_dir_config,      /* dir merger --- default is to override */
     dav_create_server_config,  /* server config */
     dav_merge_server_config,   /* merge server config */
     dav_cmds,                  /* command table */
     dav_handlers,              /* handlers */
-    NULL,                      /* filename translation */
-    NULL,                      /* check_user_id */
-    NULL,                      /* check auth */
-    NULL,                      /* check access */
-    dav_type_checker,          /* type_checker */
-    NULL,                      /* fixups */
-    NULL,                      /* logger */
-    NULL,                      /* header parser */
-    NULL,                      /* child_init */
-    NULL,                      /* child_exit */
-    NULL                       /* post read-request */
+    register_hooks,             /* register hooks */
 };
index 4cf6b88bb38a53ddcceacfea8e0424cc1b315813..d4dab1ca3a840c6522c81dc2f9629b4936b00108 100644 (file)
@@ -135,7 +135,7 @@ typedef struct dav_error {
     struct dav_error *prev;    /* previous error (in stack) */
 
     /* deferred computation of the description */
-    void (*compute_desc)(struct dav_error *err, pool *p);
+    void (*compute_desc)(struct dav_error *err, ap_pool_t *p);
     int ctx_i;
     const char *ctx_s;
     void *ctx_p;
@@ -146,7 +146,7 @@ typedef struct dav_error {
 ** Create a new error structure. save_errno will be filled with the current
 ** errno value.
 */
-dav_error *dav_new_error(pool *p, int status, int error_id, const char *desc);
+dav_error *dav_new_error(ap_pool_t *p, int status, int error_id, const char *desc);
 
 /*
 ** Push a new error description onto the stack of errors.
@@ -161,7 +161,7 @@ dav_error *dav_new_error(pool *p, int status, int error_id, const char *desc);
 ** <error_id> can specify a new error_id since the topmost description has
 ** changed.
 */
-dav_error *dav_push_error(pool *p, int status, int error_id, const char *desc,
+dav_error *dav_push_error(ap_pool_t *p, int status, int error_id, const char *desc,
                          dav_error *prev);
 
 
@@ -309,22 +309,22 @@ typedef struct
 #define DAV_BUFFER_PAD         64      /* amount of pad when growing */
 
 /* set the cur_len to the given size and ensure space is available */
-void dav_set_bufsize(pool *p, dav_buffer *pbuf, size_t size);
+void dav_set_bufsize(ap_pool_t *p, dav_buffer *pbuf, size_t size);
 
 /* initialize a buffer and copy the specified (null-term'd) string into it */
-void dav_buffer_init(pool *p, dav_buffer *pbuf, const char *str);
+void dav_buffer_init(ap_pool_t *p, dav_buffer *pbuf, const char *str);
 
 /* check that the buffer can accomodate <extra_needed> more bytes */
-void dav_check_bufsize(pool *p, dav_buffer *pbuf, size_t extra_needed);
+void dav_check_bufsize(ap_pool_t *p, dav_buffer *pbuf, size_t extra_needed);
 
 /* append a string to the end of the buffer, adjust length */
-void dav_buffer_append(pool *p, dav_buffer *pbuf, const char *str);
+void dav_buffer_append(ap_pool_t *p, dav_buffer *pbuf, const char *str);
 
 /* place a string on the end of the buffer, do NOT adjust length */
-void dav_buffer_place(pool *p, dav_buffer *pbuf, const char *str);
+void dav_buffer_place(ap_pool_t *p, dav_buffer *pbuf, const char *str);
 
 /* place some memory on the end of a buffer; do NOT adjust length */
-void dav_buffer_place_mem(pool *p, dav_buffer *pbuf, const void *mem,
+void dav_buffer_place_mem(ap_pool_t *p, dav_buffer *pbuf, const void *mem,
                           size_t amt, size_t pad);
 
 
@@ -374,7 +374,7 @@ typedef struct
 } dav_lookup_result;
 
 
-void dav_text_append(pool *p, dav_text_header *hdr, const char *text);
+void dav_text_append(ap_pool_t *p, dav_text_header *hdr, const char *text);
 
 dav_lookup_result dav_lookup_uri(const char *uri, request_rec *r);
 
@@ -405,7 +405,7 @@ typedef struct
     void *m_context;   /* module-level context (i.e. managed globals) */
 
     void *d_context;   /* per-directory context */
-    table *d_params;   /* per-directory DAV config parameters */
+    ap_table_t *d_params;      /* per-directory DAV config parameters */
 
     int *ns_map;       /* for LIVEPROP, map provider URI to global URI */
 
@@ -529,13 +529,13 @@ const dav_dyn_module *dav_find_module(const char *name);
 **
 ** NOTE: the pool should be the "configuration pool"
 */
-void dav_process_builtin_modules(pool *p);
-void dav_process_module(pool *p, const dav_dyn_module *mod);
+void dav_process_builtin_modules(ap_pool_t *p);
+void dav_process_module(ap_pool_t *p, const dav_dyn_module *mod);
 
-int * dav_collect_liveprop_uris(pool *p, const dav_hooks_liveprop *hooks);
-extern array_header *dav_liveprop_uris;
+int * dav_collect_liveprop_uris(ap_pool_t *p, const dav_hooks_liveprop *hooks);
+extern ap_array_header_t *dav_liveprop_uris;
 
-void *dav_prepare_scan(pool *p, const dav_dyn_module *mod);
+void *dav_prepare_scan(ap_pool_t *p, const dav_dyn_module *mod);
 int dav_scan_providers(void *ctx,
                       const dav_dyn_provider **provider,
                       dav_dyn_hooks *output);
@@ -734,8 +734,8 @@ typedef struct dav_xml_elem
 
 typedef struct dav_xml_doc
 {
-    dav_xml_elem *root;                /* root element */
-    array_header *namespaces;  /* array of namespaces used */
+    dav_xml_elem *root;                 /* root element */
+    ap_array_header_t *namespaces;      /* array of namespaces used */
 
 } dav_xml_doc;
 
@@ -749,10 +749,10 @@ dav_xml_elem *dav_find_child(
     const char *tagname);
 
 void dav_xml2text(
-    pool *p,
+    ap_pool_t *p,
     const dav_xml_elem *elem,
     int style,
-    array_header *namespaces,
+    ap_array_header_t *namespaces,
     int *ns_map,
     const char **pbuf,
     size_t *psize
@@ -762,9 +762,9 @@ void dav_xml2text(
 #define DAV_X2T_LANG_INNER     2       /* xml:lang + inner contents */
 #define DAV_X2T_FULL_NS_LANG   3       /* FULL + ns defns + xml:lang */
 
-const char *dav_empty_elem(pool *p, const dav_xml_elem *elem);
-void dav_quote_xml_elem(pool *p, dav_xml_elem *elem);
-const char * dav_quote_string(pool *p, const char *s, int quotes);
+const char *dav_empty_elem(ap_pool_t *p, const dav_xml_elem *elem);
+void dav_quote_xml_elem(ap_pool_t *p, dav_xml_elem *elem);
+const char * dav_quote_string(ap_pool_t *p, const char *s, int quotes);
 
 
 /* --------------------------------------------------------------------
@@ -955,7 +955,7 @@ typedef struct
 /* hook functions to enable pluggable databases */
 struct dav_hooks_db
 {
-    dav_error * (*open)(pool *p, const dav_resource *resource, int ro,
+    dav_error * (*open)(ap_pool_t *p, const dav_resource *resource, int ro,
                        dav_db **pdb);
     void (*close)(dav_db *db);
 
@@ -1140,7 +1140,7 @@ struct dav_hooks_locks
      * in the given pool.
      */
     dav_error * (*parse_locktoken)(
-        pool *p,
+        ap_pool_t *p,
         const char *char_token,
         dav_locktoken **locktoken_p
     );
@@ -1151,7 +1151,7 @@ struct dav_hooks_locks
      * Always returns non-NULL.
      */
     const char * (*format_locktoken)(
-        pool *p,
+        ap_pool_t *p,
         const dav_locktoken *locktoken
     );
 
@@ -1344,7 +1344,7 @@ dav_error *dav_open_propdb(
     dav_lockdb *lockdb,
     dav_resource *resource,
     int ro,
-    array_header *ns_xlate,
+    ap_array_header_t *ns_xlate,
     dav_propdb **propdb);
 
 void dav_close_propdb(dav_propdb *db);
@@ -1449,7 +1449,7 @@ typedef struct dav_walker_ctx
 #define DAV_CALLTYPE_LOCKNULL  3       /* called for a locknull resource */
 #define DAV_CALLTYPE_POSTFIX   4       /* postfix call for a collection */
 
-    struct pool *pool;
+    ap_pool_t *pool;
 
     request_rec *r;                    /* original request */
     dav_buffer uri;                    /* current URI */
@@ -1666,7 +1666,7 @@ struct dav_hooks_repository
      * is a collection.
      */
     dav_error * (*create_collection)(
-        pool *p, dav_resource *resource
+        ap_pool_t *p, dav_resource *resource
     );
 
     /* Copy one resource to another. The destination must not exist.
@@ -1830,7 +1830,7 @@ struct dav_hooks_vsn
 */
 
 /* allow providers access to the per-directory parameters */
-table *dav_get_dir_params(const request_rec *r);
+ap_table_t *dav_get_dir_params(const request_rec *r);
 
 /* fetch the "LimitXMLRequestBody" in force for this resource */
 size_t dav_get_limit_xml_body(const request_rec *r);
@@ -1838,7 +1838,7 @@ size_t dav_get_limit_xml_body(const request_rec *r);
 /* manage an array of unique URIs: dav_insert_uri() and DAV_GET_URI_ITEM() */
 
 /* return the URI's (existing) index, or insert it and return a new index */
-int dav_insert_uri(array_header *uri_array, const char *uri);
+int dav_insert_uri(ap_array_header_t *uri_array, const char *uri);
 #define DAV_GET_URI_ITEM(ary, i)    (((const char * const *)(ary)->elts)[i])
 
 
index 360cc6bac47679b6fa36079b8e9f9d2c16ea4b5f..5ff8be841e594d2fc6ce070f836ce16e0aac1aeb 100644 (file)
@@ -240,7 +240,7 @@ typedef struct {
 struct dav_propdb {
     int version;               /* *minor* version of this db */
 
-    pool *p;                   /* the pool we should use */
+    ap_pool_t *p;              /* the pool we should use */
     request_rec *r;            /* the request record */
 
     dav_resource *resource;    /* the target resource */
@@ -252,7 +252,7 @@ struct dav_propdb {
     short ns_count;            /* number of entries in table */
     int ns_table_dirty;                /* ns_table was modified */
 
-    array_header *ns_xlate;    /* translation of an elem->ns to URI */
+    ap_array_header_t *ns_xlate;       /* translation of an elem->ns to URI */
     int *ns_map;               /* map elem->ns to propdb ns values */
     int incomplete_map;                /* some mappings do not exist */
 
@@ -762,7 +762,7 @@ static int dav_find_dav_id(dav_propdb *propdb)
     return -1;
 }
 
-static void dav_insert_xmlns(pool *p, const char *pre_prefix, int ns,
+static void dav_insert_xmlns(ap_pool_t *p, const char *pre_prefix, int ns,
                             const char *ns_uri, dav_text_header *phdr)
 {
     const char *s;
@@ -789,7 +789,7 @@ static void dav_get_propdb_xmlns(dav_propdb *propdb, dav_text_header *phdr)
 
 /* add a namespace decl from one of the namespace tables */
 static void dav_add_marked_xmlns(dav_propdb *propdb, char *marks, int ns,
-                                array_header *ns_table,
+                                ap_array_header_t *ns_table,
                                 const char *pre_prefix,
                                 dav_text_header *phdr)
 {
@@ -945,7 +945,7 @@ dav_error *dav_really_open_db(dav_propdb *propdb, int ro)
 dav_error *dav_open_propdb(request_rec *r, dav_lockdb *lockdb,
                           dav_resource *resource,
                           int ro,
-                          array_header * ns_xlate,
+                          ap_array_header_t * ns_xlate,
                           dav_propdb **p_propdb)
 {
     dav_propdb *propdb = ap_pcalloc(r->pool, sizeof(*propdb));
index 04f2377653348f6eb5339ab12e77440c94353fe6..4887a7c6a14b80bbac5c54c47ed3ebbe3dd0e761 100644 (file)
@@ -66,7 +66,7 @@
 #include "http_protocol.h"
 
 
-dav_error *dav_new_error(pool *p, int status, int error_id, const char *desc)
+dav_error *dav_new_error(ap_pool_t *p, int status, int error_id, const char *desc)
 {
     int save_errno = errno;
     dav_error *err = ap_pcalloc(p, sizeof(*err));
@@ -81,7 +81,7 @@ dav_error *dav_new_error(pool *p, int status, int error_id, const char *desc)
     return err;
 }
 
-dav_error *dav_push_error(pool *p, int status, int error_id, const char *desc,
+dav_error *dav_push_error(ap_pool_t *p, int status, int error_id, const char *desc,
                          dav_error *prev)
 {
     dav_error *err = ap_pcalloc(p, sizeof(*err));
@@ -94,7 +94,7 @@ dav_error *dav_push_error(pool *p, int status, int error_id, const char *desc,
     return err;
 }
 
-void dav_text_append(pool * p, dav_text_header *hdr, const char *text)
+void dav_text_append(ap_pool_t * p, dav_text_header *hdr, const char *text)
 {
     dav_text *t = ap_palloc(p, sizeof(*t));
 
@@ -112,7 +112,7 @@ void dav_text_append(pool * p, dav_text_header *hdr, const char *text)
     }
 }
 
-void dav_check_bufsize(pool * p, dav_buffer *pbuf, size_t extra_needed)
+void dav_check_bufsize(ap_pool_t * p, dav_buffer *pbuf, size_t extra_needed)
 {
     /* grow the buffer if necessary */
     if (pbuf->cur_len + extra_needed > pbuf->alloc_len) {
@@ -125,7 +125,7 @@ void dav_check_bufsize(pool * p, dav_buffer *pbuf, size_t extra_needed)
     }
 }
 
-void dav_set_bufsize(pool * p, dav_buffer *pbuf, size_t size)
+void dav_set_bufsize(ap_pool_t * p, dav_buffer *pbuf, size_t size)
 {
     /* NOTE: this does not retain prior contents */
 
@@ -146,14 +146,14 @@ void dav_set_bufsize(pool * p, dav_buffer *pbuf, size_t size)
 
 
 /* initialize a buffer and copy the specified (null-term'd) string into it */
-void dav_buffer_init(pool *p, dav_buffer *pbuf, const char *str)
+void dav_buffer_init(ap_pool_t *p, dav_buffer *pbuf, const char *str)
 {
     dav_set_bufsize(p, pbuf, strlen(str));
     memcpy(pbuf->buf, str, pbuf->cur_len + 1);
 }
 
 /* append a string to the end of the buffer, adjust length */
-void dav_buffer_append(pool *p, dav_buffer *pbuf, const char *str)
+void dav_buffer_append(ap_pool_t *p, dav_buffer *pbuf, const char *str)
 {
     size_t len = strlen(str);
 
@@ -163,7 +163,7 @@ void dav_buffer_append(pool *p, dav_buffer *pbuf, const char *str)
 }
 
 /* place a string on the end of the buffer, do NOT adjust length */
-void dav_buffer_place(pool *p, dav_buffer *pbuf, const char *str)
+void dav_buffer_place(ap_pool_t *p, dav_buffer *pbuf, const char *str)
 {
     size_t len = strlen(str);
 
@@ -172,7 +172,7 @@ void dav_buffer_place(pool *p, dav_buffer *pbuf, const char *str)
 }
 
 /* place some memory on the end of a buffer; do NOT adjust length */
-void dav_buffer_place_mem(pool *p, dav_buffer *pbuf, const void *mem,
+void dav_buffer_place_mem(ap_pool_t *p, dav_buffer *pbuf, const void *mem,
                           size_t amt, size_t pad)
 {
     dav_check_bufsize(p, pbuf, amt + pad);
@@ -379,7 +379,7 @@ static int dav_text_size(const dav_text *t)
 }
 
 static size_t dav_elem_size(const dav_xml_elem *elem, int style,
-                            array_header *namespaces, int *ns_map)
+                            ap_array_header_t *namespaces, int *ns_map)
 {
     size_t size;
 
@@ -487,7 +487,7 @@ static char *dav_write_text(char *s, const dav_text *t)
 }
 
 static char *dav_write_elem(char *s, const dav_xml_elem *elem, int style,
-                           array_header *namespaces, int *ns_map)
+                           ap_array_header_t *namespaces, int *ns_map)
 {
     const dav_xml_elem *child;
     size_t len;
@@ -576,10 +576,10 @@ static char *dav_write_elem(char *s, const dav_xml_elem *elem, int style,
 }
 
 /* convert an element to a text string */
-void dav_xml2text(pool * p,
+void dav_xml2text(ap_pool_t * p,
                  const dav_xml_elem *elem,
                  int style,
-                 array_header *namespaces,
+                 ap_array_header_t *namespaces,
                  int *ns_map,
                  const char **pbuf,
                  size_t *psize)
@@ -596,7 +596,7 @@ void dav_xml2text(pool * p,
        *psize = size;
 }
 
-const char *dav_empty_elem(pool * p, const dav_xml_elem *elem)
+const char *dav_empty_elem(ap_pool_t * p, const dav_xml_elem *elem)
 {
     if (elem->ns == DAV_NS_NONE) {
        /*
@@ -618,7 +618,7 @@ const char *dav_empty_elem(pool * p, const dav_xml_elem *elem)
 ** quotes is typically set to true for XML strings that will occur within
 ** double quotes -- attribute values.
 */
-const char * dav_quote_string(pool *p, const char *s, int quotes)
+const char * dav_quote_string(ap_pool_t *p, const char *s, int quotes)
 {
     const char *scan;
     int len = 0;
@@ -678,7 +678,7 @@ const char * dav_quote_string(pool *p, const char *s, int quotes)
     return qstr;
 }
 
-void dav_quote_xml_elem(pool *p, dav_xml_elem *elem)
+void dav_quote_xml_elem(ap_pool_t *p, dav_xml_elem *elem)
 {
     dav_text *scan_txt;
     dav_xml_attr *scan_attr;
@@ -766,7 +766,7 @@ time_t dav_get_timeout(request_rec *r)
 
 /* add_if_resource returns a new if_header, linking it to next_ih.
  */
-static dav_if_header *dav_add_if_resource(pool *p, dav_if_header *next_ih,
+static dav_if_header *dav_add_if_resource(ap_pool_t *p, dav_if_header *next_ih,
                                          const char *uri, size_t uri_len)
 {
     dav_if_header *ih;
@@ -783,7 +783,7 @@ static dav_if_header *dav_add_if_resource(pool *p, dav_if_header *next_ih,
 
 /* add_if_state adds a condition to an if_header.
  */
-static dav_error * dav_add_if_state(pool *p, dav_if_header *ih,
+static dav_error * dav_add_if_state(ap_pool_t *p, dav_if_header *ih,
                                    const char *state_token,
                                    dav_if_state_type t, int condition,
                                    const dav_hooks_locks *locks_hooks)
@@ -1050,7 +1050,7 @@ static int dav_find_submitted_locktoken(const dav_if_header *if_header,
 /* dav_validate_resource_state:
  *    Returns NULL if path/uri meets if-header and lock requirements
  */
-static dav_error * dav_validate_resource_state(pool *p,
+static dav_error * dav_validate_resource_state(ap_pool_t *p,
                                               const dav_resource *resource,
                                               dav_lockdb *lockdb,
                                               const dav_if_header *if_header,
@@ -1393,12 +1393,12 @@ static dav_error * dav_validate_resource_state(pool *p,
                     ** to manipulate a resource.
                     */
                     if (lock->auth_user && 
-                        (!r->connection->user ||
-                         strcmp(lock->auth_user, r->connection->user))) {
+                        (!r->user ||
+                         strcmp(lock->auth_user, r->user))) {
                         const char *errmsg;
 
                         errmsg = ap_pstrcat(p, "User \"",
-                                            r->connection->user, 
+                                            r->user, 
                                             "\" submitted a locktoken created "
                                             "by user \"",
                                             lock->auth_user, "\".", NULL);
@@ -2111,7 +2111,7 @@ dav_error *dav_revert_resource_writability(request_rec *r,
 }
 
 /* return the URI's (existing) index, or insert it and return a new index */
-int dav_insert_uri(array_header *uri_array, const char *uri)
+int dav_insert_uri(ap_array_header_t *uri_array, const char *uri)
 {
     int i;
     const char **pelt;
index 7f0701a3e8586d57faa73a18e94d018f877c0319..a86a2ec56e30c00183a4323bdfe3e0ac08a3976c 100644 (file)
@@ -81,7 +81,7 @@ const char *dav_lock_get_activelock(request_rec *r, dav_lock *lock,
     const dav_hooks_locks *hooks = DAV_GET_HOOKS_LOCKS(r);
     int count = 0;
     dav_buffer work_buf = { 0 };
-    pool *p = r->pool;
+    ap_pool_t *p = r->pool;
 
     /* If no locks or no lock provider, there are no locks */
     if (lock == NULL || hooks == NULL) {
@@ -198,7 +198,7 @@ dav_error * dav_lock_parse_lockinfo(request_rec *r,
                                    dav_lock **lock_request)
 {
     const dav_hooks_locks *hooks = DAV_GET_HOOKS_LOCKS(r);
-    pool *p = r->pool;
+    ap_pool_t *p = r->pool;
     dav_error *err;
     dav_xml_elem *child;
     dav_lock *lock;
@@ -428,7 +428,7 @@ static dav_error * dav_unlock_walker(dav_walker_ctx *ctx, int calltype)
 ** namespace [repository] hierarchy. Note that some lock providers may be
 ** able to return this information with a traversal.
 */
-static dav_error * dav_get_direct_resource(pool *p,
+static dav_error * dav_get_direct_resource(ap_pool_t *p,
                                           dav_lockdb *lockdb,
                                           const dav_locktoken *locktoken,
                                           const dav_resource *resource,
@@ -731,7 +731,7 @@ int dav_get_resource_state(request_rec *r, const dav_resource *resource)
         if (err != NULL) {
            /* ### don't log an error. return err. add higher-level desc. */
 
-           ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r,
+           ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r,
                          "Failed to query lock-null status for %s",
                          r->filename);
 
index d64e00effba69cb90cef381e8e864fc1d798b181..fa0badedd91c5072269ba2bbf526c5689ac6720d 100644 (file)
 */
 
 /* James Clark's Expat parser */
-#include <xmlparse.h>
+/* ### need to fix this... */
+#include "../lib/expat-lite/xmlparse.h"
 
 #include "httpd.h"
 #include "http_protocol.h"
 #include "http_log.h"
 
-#include "mod_dav.h"
+/* ### need to fix this... */
+#include "../modules/dav/main/mod_dav.h"
 
 
 /* errors related to namespace processing */
@@ -79,7 +81,7 @@
 /* content for parsing */
 typedef struct dav_xml_ctx {
     dav_xml_doc *doc;          /* the doc we're parsing */
-    ap_pool *p;                        /* the pool we allocate from */
+    ap_pool_t *p;              /* the pool we allocate from */
     dav_xml_elem *cur_elem;    /* current element */
 
     int error;                 /* an error has occurred */
@@ -392,7 +394,7 @@ int dav_parse_input(request_rec * r, dav_xml_doc **pdoc)
        while ((len = ap_get_client_block(r, buffer, DAV_READ_BLOCKSIZE)) > 0) {
            total_read += len;
            if (limit_xml_body && total_read > limit_xml_body) {
-               ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, r,
+               ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r,
                              "XML request body is larger than the configured "
                              "limit of %lu", (unsigned long)limit_xml_body);
                goto read_error;
@@ -418,12 +420,12 @@ int dav_parse_input(request_rec * r, dav_xml_doc **pdoc)
     if (ctx.error) {
        switch (ctx.error) {
        case DAV_NS_ERROR_UNKNOWN_PREFIX:
-           ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r,
+           ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r,
                          "An undefined namespace prefix was used.");
            break;
 
        default:
-           ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r,
+           ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r,
                          "There was an error within the XML request body.");
            break;
        }
@@ -443,7 +445,7 @@ int dav_parse_input(request_rec * r, dav_xml_doc **pdoc)
        enum XML_Error err = XML_GetErrorCode(parser);
 
        /* ### fix this error message (default vs special) */
-       ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, r,
+       ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r,
                      "XML parser error code: %s (%d).",
                      XML_ErrorString(err), err);