Skip to content

Commit a92e608

Browse files
committed
max active locks
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1938651 13f79535-47bb-0310-9956-ffa450edef68
1 parent 6ddc724 commit a92e608

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎modules/dav/main/mod_dav.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ extern "C" {
5959
#define DAV_DO_COPY 0
6060
#define DAV_DO_MOVE 1
6161

62+
#ifndef DAV_MAX_SHARED_LOCKS
63+
#define DAV_MAX_SHARED_LOCKS (1024)
64+
#endif
6265

6366
#if 1
6467
#define DAV_DEBUG 1

‎modules/dav/main/util.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,8 @@ static dav_error * dav_validate_resource_state(apr_pool_t *p,
10421042
seen_locktoken = 1;
10431043
}
10441044
else if (flags & DAV_LOCKSCOPE_SHARED) {
1045+
unsigned count = 0;
1046+
10451047
/*
10461048
** Strictly speaking, we don't need this loop. Either the first
10471049
** (and only) lock will be EXCLUSIVE, or none of them will be.
@@ -1052,6 +1054,13 @@ static dav_error * dav_validate_resource_state(apr_pool_t *p,
10521054
"The requested resource is already "
10531055
"locked exclusively.");
10541056
}
1057+
/* Impose a maximum count of shared locks since the lock
1058+
* list is used in a linear-cost scan in many places. */
1059+
else if (count++ > DAV_MAX_SHARED_LOCKS) {
1060+
return dav_new_error(p, HTTP_FORBIDDEN, 0, 0,
1061+
"The maximum shared lock count has "
1062+
"been reached.");
1063+
}
10551064
}
10561065

10571066
/*

0 commit comments

Comments
 (0)