234 |
|
|
235 |
} |
} |
236 |
|
|
237 |
|
/** |
238 |
|
* Test the monit control file for its permissions. |
239 |
|
* @return TRUE if the Runtime control file is just accessible by the owner, |
240 |
|
* otherwise FALSE |
241 |
|
*/ |
242 |
|
|
243 |
|
int check_rcfile_permissions(void) { |
244 |
|
|
245 |
|
struct stat buf; |
246 |
|
|
247 |
|
if ( !stat(Run.controlfile, &buf) ) { |
248 |
|
|
249 |
|
if(( buf.st_mode & 077 ) > 0 ) { |
250 |
|
|
251 |
|
return FALSE; |
252 |
|
|
253 |
|
} else { |
254 |
|
|
255 |
|
return TRUE; |
256 |
|
|
257 |
|
} |
258 |
|
|
259 |
|
} |
260 |
|
|
261 |
|
return FALSE; |
262 |
|
|
263 |
|
} |
264 |
|
|
265 |
|
/** |
266 |
|
* Test the monit control file for its owner. |
267 |
|
* @return TRUE if the Runtime control file is owned by the starting user, |
268 |
|
* otherwise FALSE |
269 |
|
*/ |
270 |
|
|
271 |
|
|
272 |
|
int check_rcfile_owner(void) { |
273 |
|
|
274 |
|
struct stat buf; |
275 |
|
|
276 |
|
if ( !stat(Run.controlfile, &buf) ) { |
277 |
|
|
278 |
|
if( buf.st_uid != geteuid() ) { |
279 |
|
|
280 |
|
return FALSE; |
281 |
|
|
282 |
|
} else { |
283 |
|
|
284 |
|
return TRUE; |
285 |
|
|
286 |
|
} |
287 |
|
|
288 |
|
} |
289 |
|
|
290 |
|
return FALSE; |
291 |
|
|
292 |
|
} |