Linux Blog‎ > ‎

WebDav Quota Patch

Notes:
This page is a translated copy of the original Japanese page available at http://www.geocities.jp/t_sat7/webdav/webdav.html
Go to the original page for the most up to date version.

Disk capacity limit patch of WebDAV (apache 2.0.64,2.2.17)

                                                    サタケ <satake@goodcrew.ne.jp>
                                                    2010/11/09

- Foreword

One of the drawback of WebDAV is that there are no disk quotas. You can find more WebDav resource on the page where this WebDav Disk quota is published
WebDAV Resource JP (http://webdav.todo.gr.jp/download/) the Disk Quota that is published in
Although patch that was used has been published,
- For each user mDisk capacity limit patch of WebDAV (apache 2.0.64,2.2.17)ust issue an account on the OS
Of · apache run user rights issue
In a bit because it has a troublesome drawback, if at all, another way in the fact that ... such as 
I tried to own rewrites the Apache source of so as to be realized.

Publish here because there is also a history that heard the questions in Apach-Users ML.

Such as "'m some of the same idea and this patch" or "It is better of here Patches"
If you have any information, I am glad and give the contact Satake.

Version: 2.5

"If there is a 2GB than the file, normally not determined capacity" - from Mr. Kobayashi We had pointed out that. (Thank you very much)
  ⇒2GB超対応
System-dependent version Fixed a mistake to cluster computing at the time of judgment capacity of
※ For 2GB than the corresponding apache
As an option at compile time in order to handle the 2GB than the file in the apache 2.2.x
-D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64
It seems there is a need to specify.
How to specify I think that many things there, but I think simple is how to make and set the string to the environment variable CFLAGS.

Example script:
===
#! /bin/bash

CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
export CFLAGS

buildconf && configure [オプション] && make
===

Version: 2.4

- From Sebastian said "apr_lstat in apache2.2.x () is undefine" We had pointed out that.
 Nde apr_lstat () - change in> apr_stat ()

Version: 2.3

· Eduardoh from said "I want to specify the DAVSATMaxAreaSize in the .htaccess" is a request by e-mail
 Since I came, correspondence. ... Not recommended any time ....
Ohno Mr. ( Http://Atwiki.Jp/ ) than if you specify a directory with a '*' Among the "<Directory>, the capacity limit
 I had pointed out that ineffective not ". (Thank you very much)
 Nde the bug correspondence.

Version: 2.2

Fixed a bug that Doing ./buildconf configure is rewritten fixes that were addressed in this patch becomes the Chara.
How to Marco Gobenich Mr. who has pointed out this defect apply this patch to SPRM package of 2.0.50 Ya
You have me to publish the specs file at that time.
http://www.needful.de/docs/projekte/webdav-quota/
Thank you thank you!

· WebDAV Patch Download links

WebDAV capacity limit patch (system-dependent version):




WebDAV patch archive file (system-independent version):




- Description of the processing of the patch

webdav-2.0.55-quota-2.3.txt system-dependent patch
webdav-2.0.55-quota-2.3any.txt system-independent patch

webdav-2.0.55-quota-2.3.txt is dependent on the system
Specifically, by using the lstat () function will have to calculate the data occupancy size on the storage.
Once, size is calculated'm going to are combined with the output of "du -sk".
However, hard link does not take into account. Duplicate to calculate the size, but on the WebDAV
I did not narrowing put without permission judgment and ... wonder if much of a problem is not in that use.

But I think that for most of the Unix-based OS has been implemented lstat () function, if not
Or to change to a certain function, please patched of system-independent version.
However system independent of the patch is the file size in the internal functions of Apache without using the lstat ()
Since it is only the sum, it does not match the size that occupies actually the storage.
Once defined the cluster size in quota.h (4k by default), it has been translated to a cluster size
Since you have the sum, the fact that the small file comes out violently different value even in a large amount
I think ... maybe not.

This cluster size is, in quota.h
#define DAV_CLUSTER_SIZE    4096
Or rewrite the part that you are, by specifying the -DDAV_CLUSTER_SIZE = xxx such as the compiler option
I think that the amount used in a more close value be rewritten to those of your storage coming out.

Method of setting WebDAV settings (set of disk capacity limit) as you'll see the,
A bit I do not know the point is ... associated with it.


· Apache archive of thawing

Extract as described below.

#gtar xvfz httpd-2.0.55.tar.gz


Patching

Fall within the directory as, put the patch file webdav-2.0.55-quota-2.3.txt in its place.
 #cd httpd-2.0.55

#patch -p2 < webdav-2.0.55-quota-2.3.txt
Patch to apache like

webdav-2.0.55-quota-2.3.txt:
    This patch in the following three file modules / dav / main / mod_dav.c, configure,
    Change the modules / dav / main / config5.m4,
    The following two file modules / dav / main / quotachk.h, the modules / dav / main / quotachk.c
    And newly added.
· Recompile Apache

After that mod_dav, please to configure & make so mod_davfs is on.
configure did the following in my case.

#./buildconf
#./configure \
  --enable-modules=most \
  --enable-mods-shared=all \
  --enable-ssl \
  --with-ssl=/usr/local/ssl
#make
#his
#make install


· WebDAV settings

For the various settings of WebDAV, please refer to the various Web pages and following URLs:
WebDAV Resources (http://www.webdav.org/)
WebDAV Resources JP (http://webdav.todo.gr.jp/)

This section describes the settings for the part about the capacity limit of the disk that Satake was created.

Additional settings

(1) DAVSATMaxAreaSize Added directives
You can limit the capacity of the following each directory in this directive.
WebDAV is the total capacity of the following directory indicated by this directive has been specified
Size will be monitored at the time of writing as to be equal to or less than.
Please specify in the MAX size you specify only the number of kilobytes (KB) (calculation formula is not allowed)
If you do not specify this DavMaxAreaSize directive, capacity check is not performed if you specify a 0.

Note 2:
Symbolic links are not followed. The output of the capacity calculation routine was tailored to du -sk command.
(I wonder if you do not this symbolic link to the non-correspondence of the also WebDAV drawbacks ... somehow ~)
However, although du command will take into account the hard link, this routine does not take into account.
As if we each have a capacity of files that have been hard link below the same Directory
Calculated you.


Setting Example:

DAVLockDB  /usr/local/apache2/logs/DAVLock

Alias   /dav-test-one   "/var/NAS/00001"
<Directory "/var/NAS/00001">
    DAV on
    #
    # Limit the capacity of less than or equal to this directory to 100MB
    #
    DAVSATMaxAreaSize 102400
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

Alias   /dav-test-two   "/var/NAS/00002"
<Directory "/var/NAS/00002">
    DAV on
    #
    # Limit the capacity of less than or equal to this directory to 100KB
    #
    DAVSATMaxAreaSize 100
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

In this example / dav-test-one is 100MB, / dav-test-two is to 100KB
It will be capacity limited.


Other stuff
And capacity limit can be hierarchical. For example, / dav-one / pub is 10KB, / dav-one / etc is 20KB,
  Other directory together / dav-one as a whole is specified, such as 50KB ··.

• The capacity limit from version 2.3 DAVSATMaxAreaSize can override set in .htaccess like.
  If a warning message appears error_log is, to put the DAV On in .htaccess
  It will not be out. This way too much even ... is not recommended, but ....