Changeset 481 for trunk/src/sh_suidchk.c


Ignore:
Timestamp:
Jul 18, 2015, 5:06:52 PM (9 years ago)
Author:
katerina
Message:

Enhancements and fixes for tickets #374, #375, #376, #377, #378, and #379.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_suidchk.c

    r474 r481  
    7878#include "sh_suidchk.h"
    7979#include "sh_hash.h"
     80#include "sh_dbIO.h"
    8081#include "sh_unix.h"
    8182#include "sh_files.h"
     
    140141static int     ShSuidchkActive   = S_TRUE;
    141142static time_t  ShSuidchkInterval = 7200;
    142 static long    ShSuidchkFps      = 0;
     143static unsigned long    ShSuidchkFps      = 0;
    143144static int     ShSuidchkNosuid   = S_FALSE;
    144145static int     ShSuidchkYield    = S_FALSE;
     
    150151static time_t  FileLimNow        = 0;
    151152static time_t  FileLimStart      = 0;
    152 static long    FileLimNum        = 0;
    153 static long    FileLimTotal      = 0;
     153static unsigned long    FileLimNum        = 0;
     154static unsigned long    FileLimTotal      = 0;
    154155
    155156static sh_schedule_t * ShSuidchkSched = NULL;
     
    11341135    /* Rate limit (Fps == Files per second)
    11351136     */
    1136     if ((ShSuidchkFps > 0 && FileLimNum > ShSuidchkFps && FileLimTotal > 0)&&
     1137    if ((ShSuidchkFps > 0 && FileLimNum > ShSuidchkFps) &&
    11371138        (ShSuidchkYield == S_FALSE))
    11381139      {
     
    12221223            int dummy;
    12231224            int class;
    1224             unsigned long check_mask = 0;
     1225            unsigned long check_flags = 0;
    12251226
    12261227            theFile = SH_ALLOC(sizeof(file_type));
    12271228
    12281229            (void) sl_strlcpy (theFile->fullpath, tmpcat, PATH_MAX);
    1229             theFile->check_mask  = sh_files_maskof(SH_LEVEL_READONLY);
     1230            theFile->check_flags  = sh_files_maskof(SH_LEVEL_READONLY);
    12301231            CLEAR_SH_FFLAG_REPORTED(theFile->file_reported);
    12311232            theFile->attr_string = NULL;
    12321233            theFile->link_path   = NULL;
    12331234           
    1234             sh_files_search_file(tmpcat, &class,  &check_mask, &dummy);
    1235             if ((check_mask & MODI_PREL) != 0)
    1236               {
    1237                 theFile->check_mask |= MODI_PREL;
    1238               }
     1235            sh_files_search_file(tmpcat, &class,  &check_flags, &dummy);
     1236            if ((check_flags & MODI_PREL) != 0)
     1237              MODI_SET(theFile->check_flags, MODI_PREL);
    12391238
    12401239            status = sh_unix_getinfo (ShDFLevel[SH_ERR_T_RO],
     
    13031302                    /* Running init. Report on files detected.
    13041303                     */
    1305                     sh_hash_pushdata (theFile, fileHash); /* no call to sh_error_handle */
     1304                    sh_dbIO_data_write (theFile, fileHash); /* no call to sh_error_handle */
    13061305                    SH_MUTEX_LOCK(mutex_thread_nolog);
    13071306                    sh_error_handle ((-1), FIL__, __LINE__,
     
    22152214}
    22162215
    2217 /* This variable is not used anywhere. It only exists
    2218  * to assign &dirlist to it, which keeps gcc from
    2219  * putting it into a register, and avoids the 'clobbered
    2220  * by longjmp' warning. And no, 'volatile' proved insufficient.
    2221  */
    2222 static void * sh_dummy_type = NULL;
    2223 
    2224 
    22252216/* Return a newly allocated string naming the type of filesystem that the
    22262217   file PATH, described by STATP, is on.
    22272218   RELPATH is the file name relative to the current directory.
    22282219   Return "unknown" if its filesystem type is unknown.  */
     2220
     2221void * sh_dummy_2229_type;
    22292222
    22302223static char *
     
    22432236  FILE *mfp;
    22442237  struct mntent *mnt;
     2238
     2239  /* Take the address to keep gcc from putting it into a register.
     2240   * Avoids the 'clobbered by longjmp' warning.
     2241   */
     2242  sh_dummy_2229_type = (void *) &type;
    22452243
    22462244  if (path == NULL || relpath == NULL)
     
    22572255      return NULL;
    22582256    }
    2259 
    2260   /* Take the address to keep gcc from putting it into a register.
    2261    * Avoids the 'clobbered by longjmp' warning.
    2262    */
    2263   sh_dummy_type = (void*) &type;
    22642257
    22652258  /* Find the entry with the same device number as STATP, and return
Note: See TracChangeset for help on using the changeset viewer.