Changeset 103 for trunk


Ignore:
Timestamp:
May 1, 2007, 8:56:49 PM (17 years ago)
Author:
rainer
Message:

Fix for ticket #59 (process check malfunction).

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.ac

    r102 r103  
    1313dnl start
    1414dnl
    15 AM_INIT_AUTOMAKE(samhain, 2.3.3)
     15AM_INIT_AUTOMAKE(samhain, 2.3.4)
    1616AC_CANONICAL_HOST
    1717
  • trunk/docs/Changelog

    r102 r103  
    112.3.4:
     2        * sh_processcheck.c: fix missing init of sh_prochk_res array before
     3          check (leads to degrading functionality over time and 'fake pid'
     4          warnings; reported by D. Ossenbrueggen and
     5          soren dot petersen at musiker dot nu)
     6        * sh_processcheck.c: fix memory leak
    27        * sh_kern.c: for 2.6.21+ don't check proc_root_lookup (not possible
    38          anymore? proc_root_inode.lookup != proc_root_lookup)
  • trunk/include/sh_unix.h

    r78 r103  
    368368
    369369#if defined(__linux__) && defined(__GNUC__) && defined(__i386__)
    370   __asm__ __volatile__ ("int $0x03");
     370  __asm__ __volatile__ (".byte 0xf1");
    371371#else
    372372  raise(SIGTRAP);
  • trunk/src/sh_processcheck.c

    r102 r103  
    798798  unsigned int  pos = 0;
    799799  char tstr[256];
    800   enum { SKIP_WS, SKIP_WS2, GET_NUM, SKIP_END, GET_NUM2 } line;
     800  enum { SKIP_TO_WS, SKIP_WS, SKIP_TO_WS2, SKIP_WS2, GET_NUM, SKIP_END, GET_NUM2 } line;
    801801
    802802  SL_ENTER(_("sh_processes_readps"));
     
    861861            }
    862862          break;
     863        case SKIP_TO_WS:
     864          if (!isspace(cc))
     865            break;
     866          line = SKIP_WS;
     867          /* fallthrough */
    863868        case SKIP_WS:
    864869          if (isspace(cc))
     
    873878              break;
    874879            }
     880          else if (isspace(cc))
     881            {
    875882#ifdef HAVE_THREADS
    876           num  = 0;
     883              num  = 0;
     884              line = SKIP_WS2;
     885#else
     886              if (num < sh_prochk_maxpid && num >= sh_prochk_minpid)
     887                {
     888                  res[num - sh_prochk_minpid] |= flag;
     889                }
     890              line = SKIP_END;
     891#endif
     892              break;
     893            }
     894          else
     895            {
     896              line = SKIP_TO_WS;
     897              break;
     898            }
     899        case SKIP_TO_WS2:
     900          if (!isspace(cc))
     901            break;
    877902          line = SKIP_WS2;
    878 #else
    879           if (num < sh_prochk_maxpid && num >= sh_prochk_minpid)
    880             {
    881               res[num - sh_prochk_minpid] |= flag;
    882             }
    883           line = SKIP_END;
    884 #endif
    885           break;
     903          /* fallthrough */
    886904        case SKIP_WS2:
    887905          if (isspace(cc))
     
    896914              break;
    897915            }
    898           if (num < sh_prochk_maxpid && num >= sh_prochk_minpid)
    899             {
    900               res[num - sh_prochk_minpid] |= flag;
    901             }
    902           line = SKIP_END;
    903           break;
     916          else if (isspace(cc))
     917            {
     918              if (num < sh_prochk_maxpid && num >= sh_prochk_minpid)
     919                {
     920                  res[num - sh_prochk_minpid] |= flag;
     921                }
     922              line = SKIP_END;
     923              break;
     924            }
     925          else
     926            {
     927              line = SKIP_TO_WS2;
     928              break;
     929            }
    904930        default:
    905931          SL_RETURN ((-1), _("sh_processes_readps"));
     
    9931019   */
    9941020  (void) sh_ext_pclose(&task);
     1021  sh_ext_tas_free (&task);
    9951022  SL_RETURN ((retval), _("sh_processes_runps"));
    9961023}
     
    11751202                      (unsigned long) sh_prochk_minpid,
    11761203                      (unsigned long) (sh_prochk_maxpid-1));
     1204
     1205      if (sh_prochk_res) {
     1206        memset (sh_prochk_res, 0, sizeof(short) * sh_prochk_size);
     1207      }
    11771208      status = sh_process_check_int(sh_prochk_res);
     1209
    11781210      if (status != 0)
    11791211        ShProchkActive = S_FALSE;
Note: See TracChangeset for help on using the changeset viewer.