@@ -151,6 +151,18 @@ int acquire_global_lock(apr_global_mutex_t *lock, apr_pool_t *mp) {
151
151
ap_log_perror (APLOG_MARK , APLOG_ERR , 0 , NULL , " ModSecurity: Could not create global mutex" );
152
152
return -1 ;
153
153
}
154
+ #if !defined(MSC_TEST )
155
+ #ifdef __SET_MUTEX_PERMS
156
+ #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2
157
+ rc = ap_unixd_set_global_mutex_perms (lock );
158
+ #else
159
+ rc = unixd_set_global_mutex_perms (lock );
160
+ #endif
161
+ if (rc != APR_SUCCESS ) {
162
+ return -1 ;
163
+ }
164
+ #endif /* SET_MUTEX_PERMS */
165
+ #endif /* MSC_TEST */
154
166
return APR_SUCCESS ;
155
167
}
156
168
/**
@@ -163,7 +175,7 @@ int modsecurity_init(msc_engine *msce, apr_pool_t *mp) {
163
175
164
176
msce -> auditlog_lock = msce -> geo_lock = NULL ;
165
177
#ifdef GLOBAL_COLLECTION_LOCK
166
- msce -> geo_lock = NULL ;
178
+ msce -> dbm_lock = NULL ;
167
179
#endif
168
180
169
181
/**
@@ -182,54 +194,17 @@ int modsecurity_init(msc_engine *msce, apr_pool_t *mp) {
182
194
return -1 ;
183
195
}
184
196
185
- #if !defined(MSC_TEST )
186
- #ifdef __SET_MUTEX_PERMS
187
- #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2
188
- rc = ap_unixd_set_global_mutex_perms (msce -> auditlog_lock );
189
- #else
190
- rc = unixd_set_global_mutex_perms (msce -> auditlog_lock );
191
- #endif
192
- if (rc != APR_SUCCESS ) {
193
- // ap_log_error(APLOG_MARK, APLOG_ERR, rc, s, "mod_security: Could not set permissions on modsec_auditlog_lock; check User and Group directives");
194
- // return HTTP_INTERNAL_SERVER_ERROR;
195
- return -1 ;
196
- }
197
- #endif /* SET_MUTEX_PERMS */
198
-
199
197
rc = acquire_global_lock (msce -> geo_lock , mp );
200
198
if (rc != APR_SUCCESS ) {
201
199
return -1 ;
202
200
}
203
201
204
- #ifdef __SET_MUTEX_PERMS
205
- #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2
206
- rc = ap_unixd_set_global_mutex_perms (msce -> geo_lock );
207
- #else
208
- rc = unixd_set_global_mutex_perms (msce -> geo_lock );
209
- #endif
210
- if (rc != APR_SUCCESS ) {
211
- return -1 ;
212
- }
213
- #endif /* SET_MUTEX_PERMS */
214
-
215
202
#ifdef GLOBAL_COLLECTION_LOCK
216
203
rc = acquire_global_lock (& msce -> dbm_lock , mp );
217
204
if (rc != APR_SUCCESS ) {
218
205
return -1 ;
219
206
}
220
-
221
- #ifdef __SET_MUTEX_PERMS
222
- #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2
223
- rc = ap_unixd_set_global_mutex_perms (msce -> dbm_lock );
224
- #else
225
- rc = unixd_set_global_mutex_perms (msce -> dbm_lock );
226
- #endif
227
- if (rc != APR_SUCCESS ) {
228
- return -1 ;
229
- }
230
- #endif /* SET_MUTEX_PERMS */
231
- #endif
232
- #endif
207
+ #endif /* GLOBAL_COLLECTION_LOCK */
233
208
234
209
return 1 ;
235
210
}
0 commit comments