Changeset 52 for trunk


Ignore:
Timestamp:
Jul 24, 2006, 11:01:29 PM (18 years ago)
Author:
rainer
Message:

Fix stealth mode (regression in parser), add test for regression test suite

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/Changelog

    r51 r52  
     12.2.3:
     2        * fix stealth mode (regression in parser), problem reported by
     3          Joschi Kuphal
     4
    152.2.2 (17-07-2006)
    26        * minor fixes for regression test scripts
  • trunk/src/samhain.c

    r34 r52  
    14491449
    14501450#if (defined(WITH_GPG) || defined(WITH_PGP))
    1451   /* do nothing -- we exit earlier if error
    1452   if (0 != sh_gpg_check_sign (1))
    1453     aud_exit(FIL__, __LINE__, EXIT_FAILURE);
    1454   */
     1451  /* do nothing -- we exit earlier if error */
    14551452#else
    14561453  sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_START_1H,
     
    14741471    {
    14751472#if (defined(WITH_GPG) || defined(WITH_PGP))
    1476       /* do nothing -- we exit earlier if error
    1477          if (0 != sh_gpg_check_sign (2))
    1478          aud_exit(FIL__, __LINE__, EXIT_FAILURE);
    1479       */
    1480       ;
     1473      /* do nothing -- we exit earlier if error */
    14811474#else
    14821475      sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_START_2H,
     
    14891482    {
    14901483#if (defined(WITH_GPG) || defined(WITH_PGP))
    1491       /* do nothing -- we exit earlier if error
    1492       if (0 != sh_gpg_check_sign (1))
    1493         aud_exit(FIL__, __LINE__, EXIT_FAILURE);
    1494       */
    1495       ;
     1484      /* do nothing -- we exit earlier if error */
    14961485#else
    14971486      sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_START_1H,
  • trunk/src/sh_unix.c

    r49 r52  
    41224122int sh_unix_getline_stealth (SL_TICKET fd, char * str, int len)
    41234123{
    4124   int           add_off, llen;
    4125   unsigned long off_data = 0;
    4126   unsigned long max_data = 0;
    4127   static int    stealth_init = BAD;
     4124  int                  add_off, llen;
     4125  static unsigned long off_data = 0;
     4126  static unsigned long max_data = 0;
     4127  static int           stealth_init = BAD;
    41284128
    41294129  SL_ENTER(_("sh_unix_getline_stealth"));
     
    41444144        }
    41454145      stealth_init = GOOD;
     4146      max_data += off_data;
    41464147    }
    41474148 
    41484149  /* --- Seek to proper position. ---
    41494150   */
     4151  if (off_data >= max_data)
     4152    {
     4153      dlog(1, FIL__, __LINE__,
     4154           _("The capacity of the container image file for the stealth config file seems to be too small. Your config file is likely truncated.\n"));
     4155      sh_error_handle ((-1), FIL__, __LINE__,  EIO, MSG_P_NODATA,
     4156                       _("Stealth config file."));
     4157      aud_exit (FIL__, __LINE__, EXIT_FAILURE);
     4158    }
    41504159  sl_seek(fd, off_data);
    41514160     
     
    41544163  add_off   = hideout_hex_block(fd, (unsigned char *) str, len);
    41554164  off_data += add_off;
    4156 
    41574165
    41584166  llen = sl_strlen(str);
  • trunk/test/testrun_1b.sh

    r51 r52  
    2020#
    2121
    22 MAXTEST=2; export MAXTEST
     22MAXTEST=3; export MAXTEST
    2323LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
    2424RCFILE="$PW_DIR/testrc_1.dyn";  export RCFILE
     
    7070            [ -z "$quiet" ]   && log_msg_fail  "extract gpg signed files...";
    7171            return 1
     72        fi
     73
     74        if test "x$2" = "x"; then
     75            :
     76        else
     77            CONVERT="$2"
     78            if test -f "${TOP_SRCDIR}/stealth_template.jpg"; then
     79                [ -z "$verbose" ] || log_msg_ok "convert..."
     80                "${CONVERT}" +compress "${TOP_SRCDIR}/stealth_template.jpg" stealth_template.ps >/dev/null
     81            else
     82                [ -z "$quiet" ]   && log_msg_fail  "cannot find file stealth_template.jpg"
     83                return 1
     84            fi
     85            if [ $? -ne 0 ]; then
     86                [ -z "$quiet" ]   && log_msg_fail  "${CONVERT} +compress ${TOP_SRCDIR}/stealth_template.jpg stealth_template.ps";
     87                return 1
     88            fi
     89
     90            [ -z "$verbose" ] || log_msg_ok "hide..."
     91            ./samhain_stealth -s stealth_template.ps "$RCFILE" >/dev/null
     92            if [ $? -ne 0 ]; then
     93                [ -z "$quiet" ]   && log_msg_fail  "${CONVERT} +compress ${TOP_SRCDIR}/stealth_template.jpg stealth_template.ps";
     94                return 1
     95            fi
     96
     97            mv -f stealth_template.ps "$RCFILE"
     98            if [ $? -ne 0 ]; then
     99                [ -z "$quiet" ]   && log_msg_fail  "mv -f stealth_template.ps $RCFILE";
     100                return 1
     101            fi
     102
    72103        fi
    73104
     
    171202            log_skip 2 $MAXTEST 'public PGP key 0x0F571F6C not present'
    172203        else
     204            #
     205            # -------------  first test -------------
     206            #
    173207            BUILDOPTS="--quiet $TRUST --enable-debug --with-gpg=${GPG} --with-checksum=no --enable-micro-stealth=137 --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file"
    174             testrun1b_internal "${BUILDOPTS}"
     208            testrun1b_internal "${BUILDOPTS}" 
    175209            do_test_1b
    176210            if [ $? -eq 0 ]; then
     
    179213                log_fail 1 $MAXTEST 'gpg signed config/database files'
    180214            fi
     215
     216
     217            #
     218            # -------------  second test -------------
     219            #
     220            PRECONV=`find_path convert`
     221            "${PRECONV}" --help | grep  ImageMagick >/dev/null 2>&1 && \
     222                CONVERT="${PRECONV}"
     223
     224            if [ -z "$CONVERT" ]; then
     225                log_skip 2 $MAXTEST 'ImageMagick convert not found in $PATH'
     226            else
     227                BUILDOPTS="--quiet $TRUST --enable-debug --with-gpg=${GPG} --with-checksum=no --enable-stealth=137 --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file"
     228                testrun1b_internal "${BUILDOPTS}" "$CONVERT"
     229                do_test_1b
     230                if [ $? -eq 0 ]; then
     231                    log_ok   2 $MAXTEST 'gpg signed config/database files'
     232                else
     233                    log_fail 2 $MAXTEST 'gpg signed config/database files'
     234                fi
     235            fi
     236
     237
     238            #
     239            # -------------  third test -------------
     240            #
    181241            PM=`find_path prelude-manager`
    182242            if [ -z "$PM" ]; then
    183                 log_skip 2 $MAXTEST 'prelude-manager not found in $PATH'
     243                log_skip 3 $MAXTEST 'prelude-manager not found in $PATH'
    184244            elif [ -z "$doall" ]; then
    185                 log_skip 2 $MAXTEST 'logging to prelude (or use --really-all)'
     245                log_skip 3 $MAXTEST 'logging to prelude (or use --really-all)'
    186246            else
    187247                BUILDOPTS="--quiet $TRUST --enable-debug --with-prelude --with-gpg=${GPG} --with-checksum=no --enable-micro-stealth=137 --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file"
     
    189249                do_test_1b_2
    190250                if [ $? -eq 0 ]; then
    191                     log_ok   2 $MAXTEST 'logging to prelude'
     251                    log_ok   3 $MAXTEST 'logging to prelude'
    192252                else
    193                     log_fail 2 $MAXTEST 'logging to prelude'
     253                    log_fail 3 $MAXTEST 'logging to prelude'
    194254                fi
    195255            fi
Note: See TracChangeset for help on using the changeset viewer.