Changeset 59 for trunk/src


Ignore:
Timestamp:
Aug 31, 2006, 9:25:02 PM (18 years ago)
Author:
rainer
Message:

Fix for exit status if database load fails; fix for problem with GrowingLogFiles if signed database is used; better support for *BSD init script installation.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/samhain.c

    r52 r59  
    652652  sh_files_delfilestack ();
    653653  sh_hash_hashdelete();
     654  sh_files_hle_reg (NULL);
    654655#endif
    655656#if defined(SH_WITH_SERVER)
     
    13691370    }
    13701371
    1371   /* initialize signal handling etc
    1372    */
    13731372  if (sh.flag.isdaemon == S_TRUE)
    13741373    sh_error_only_stderr (BAD);
    13751374
     1375  /* --- load database; checksum of database
     1376   */
     1377#if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE)
     1378  TPT((0, FIL__, __LINE__, _("msg=<Get checksum of the database.>\n")))
     1379  if (sh.flag.checkSum == SH_CHECK_CHECK)
     1380    {
     1381      if (0 != sl_strcmp(file_path('D', 'R'), _("REQ_FROM_SERVER")))
     1382        {
     1383          (void) sl_strlcpy(sh.data.hash,
     1384                            sh_tiger_hash (file_path('D', 'R'),
     1385                                           TIGER_FILE, 0),
     1386                            KEY_LEN+1);
     1387        }
     1388
     1389      /* this eventually fetches the file from server to get checksum
     1390       */
     1391      sh_hash_init ();
     1392    }
     1393#endif
     1394
     1395  /* --- initialize signal handling etc.; fork daemon
     1396   */
    13761397  if (sh_unix_init(sh.flag.isdaemon) == -1)
    13771398    {
     
    14091430#if defined(INET_SYSLOG) && defined(SH_WITH_SERVER)
    14101431  create_syslog_socket (S_FALSE);
    1411 #endif
    1412 
    1413 
    1414   /* checksum of database
    1415    */
    1416 #if defined (SH_WITH_CLIENT) || defined (SH_STANDALONE)
    1417   TPT((0, FIL__, __LINE__, _("msg=<Get checksum of the database.>\n")))
    1418   if (sh.flag.checkSum == SH_CHECK_CHECK)
    1419     {
    1420       if (0 == sl_strcmp(file_path('D', 'R'), _("REQ_FROM_SERVER")))
    1421         {
    1422           /* fetch the file from server to get checksum
    1423            */
    1424           sh_hash_init ();
    1425           /* sh_hash_hashdelete (); */
    1426         }
    1427       else
    1428         {
    1429           (void) sl_strlcpy(sh.data.hash,
    1430                             sh_tiger_hash (file_path('D', 'R'),
    1431                                            TIGER_FILE, 0),
    1432                             KEY_LEN+1);
    1433         }
    1434     }
    14351432#endif
    14361433
  • trunk/src/sh_unix.c

    r52 r59  
    28432843  SL_ENTER(_("sh_unix_checksum_size"));
    28442844
    2845   /* lookup file in database */
    2846   status = sh_hash_get_it (filename, &tmpFile);
    2847   if (status != 0) {
    2848     goto out;
    2849   }
     2845  if (sh.flag.checkSum != SH_CHECK_INIT)
     2846    {
     2847      /* lookup file in database */
     2848      status = sh_hash_get_it (filename, &tmpFile);
     2849      if (status != 0) {
     2850        goto out;
     2851      }
     2852    }
     2853  else
     2854    {
     2855      tmpFile.size = fbuf->st_size;
     2856    }
    28502857
    28512858  /* if last < current get checksum */
     
    28532860    {
    28542861      sl_strlcpy(fileHash,
    2855                 sh_tiger_generic_hash (filename, TIGER_FD, tmpFile.size,
    2856                                        alert_timeout),
    2857                 KEY_LEN+1);
     2862                 sh_tiger_generic_hash (filename, TIGER_FD, tmpFile.size,
     2863                                        alert_timeout),
     2864                 KEY_LEN+1);
    28582865
    28592866      /* return */
Note: See TracChangeset for help on using the changeset viewer.