Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1121ef0

Browse files
authored
Merge pull request #3269 from marcstern/v2/pr/apr_mutex_create
Fix apr_global_mutex_create() usage
2 parents 9666663 + 36a4194 commit 1121ef0

File tree

3 files changed

+4
-27
lines changed

3 files changed

+4
-27
lines changed

‎CHANGES‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
(to be released) - 2.9.x
22
------------------------
33

4-
* handle errors from apr_global_mutex_lock
4+
* Fixed apr_global_mutex_create() usage (no filename)
5+
[PR #3269 - @marcstern]
6+
* handle errors from apr_global_mutex_lock
57
[PR #3257 - @marcstern]
68

79
03 Sep 2024 - 2.9.8

‎apache2/modsecurity.c‎

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -123,30 +123,7 @@ msc_engine *modsecurity_create(apr_pool_t *mp, int processing_mode) {
123123
}
124124

125125
int acquire_global_lock(apr_global_mutex_t **lock, apr_pool_t *mp) {
126-
apr_status_t rc;
127-
apr_file_t *lock_name;
128-
const char *temp_dir;
129-
const char *filename = NULL;
130-
131-
// get platform temp dir
132-
rc = apr_temp_dir_get(&temp_dir, mp);
133-
if (rc != APR_SUCCESS) {
134-
ap_log_perror(APLOG_MARK, APLOG_ERR, 0, mp, "ModSecurity: Could not get temp dir");
135-
return -1;
136-
}
137-
138-
// use temp path template for lock files
139-
char *path = apr_pstrcat(mp, temp_dir, GLOBAL_LOCK_TEMPLATE, NULL);
140-
141-
rc = apr_file_mktemp(&lock_name, path, 0, mp);
142-
if (rc != APR_SUCCESS) {
143-
ap_log_perror(APLOG_MARK, APLOG_ERR, 0, mp, " ModSecurity: Could not create temporary file for global lock");
144-
return -1;
145-
}
146-
// below func always return APR_SUCCESS
147-
apr_file_name_get(&filename, lock_name);
148-
149-
rc = apr_global_mutex_create(lock, filename, APR_LOCK_DEFAULT, mp);
126+
apr_status_t rc = apr_global_mutex_create(lock, NULL, APR_LOCK_DEFAULT, mp);
150127
if (rc != APR_SUCCESS) {
151128
ap_log_perror(APLOG_MARK, APLOG_ERR, 0, mp, " ModSecurity: Could not create global mutex");
152129
return -1;

‎apache2/modsecurity.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,6 @@ typedef struct msc_parm msc_parm;
135135

136136
#define FATAL_ERROR "ModSecurity: Fatal error (memory allocation or unexpected internal error)!"
137137

138-
#define GLOBAL_LOCK_TEMPLATE "/modsec-lock-tmp.XXXXXX"
139-
140138
extern DSOLOCAL char *new_server_signature;
141139
extern DSOLOCAL char *real_server_signature;
142140
extern DSOLOCAL char *chroot_dir;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /