/[monit]/monit/files.c
ViewVC logotype

Diff of /monit/files.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by hauk, Fri Sep 6 18:13:37 2002 UTC revision 1.7 by chopp, Thu Sep 12 16:08:39 2002 UTC
# Line 234  time_t file_changedtime(char *file) { Line 234  time_t file_changedtime(char *file) {
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    }

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26