Changeset 89


Ignore:
Timestamp:
Jan 29, 2007, 9:40:44 PM (18 years ago)
Author:
rainer
Message:

Fix for ticket #49 (stealth mode broken). Regression test added.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.ac

    r87 r89  
    1313dnl start
    1414dnl
    15 AM_INIT_AUTOMAKE(samhain, 2.3.1a)
     15AM_INIT_AUTOMAKE(samhain, 2.3.2)
    1616AC_CANONICAL_HOST
    1717
  • trunk/docs/Changelog

    r87 r89  
    1 2.3.1a:
     12.3.2:
     2        * fix regression in full stealth mode (incorrect comparison of
     3          bytes read vs. maximum capacity), reported by B. Fleming
     4
     52.3.1a (21-01-2007):
    26        * fix incorrect use of sh_gpg_fill_startup if option --with-fp is used
    37          (reported by zeroXten)
  • trunk/docs/HOWTO-client+server-troubleshooting.html

    r1 r89  
    3030div.warnblock {
    3131        background: #b6c5f2; color: #000;
     32        background: #ffffcc; color: #000;
    3233        margin: 1em; padding: 0 1em 0 1em;
    3334        border-width: 1px;
     
    131132<br>
    132133<hr>
     134<div class="warnblock">
     135<ul>
     136  <li>Almost all problems can only be diagnosed correctly by checking the
     137      <b>server</b> logs</li>
     138  <li>If the server does not write logs, <b>fix this first</b>. For debugging,
     139      stop the server, then run it in the foreground with
     140      <tt>yule -p info --foreground</tt></li>
     141</div>
    133142<p>
    134143This document aims to explain how to diagnose and fix common problems that
     
    255264     the interface used is not the one the client name resolves to.
    256265     </p>
     266
    257267       <p>
    258268       If the client uses the wrong interface on a multi-interface machine,
     
    264274       <p>
    265275       If you want to download the config file from the server, you
    266        should instead use the corresponding command line
     276       should instead use the corresponding command line option
    267277       <tt>--bind-address=</tt><i>IP address</i>
    268278       to select the interface.
  • trunk/src/sh_unix.c

    r86 r89  
    43234323
    43244324
    4325 int hideout_hex_block(SL_TICKET fd, unsigned char * str, int len);
     4325int hideout_hex_block(SL_TICKET fd, unsigned char * str, int len,
     4326                      unsigned long * bytes_read);
    43264327unsigned long first_hex_block(SL_TICKET fd, unsigned long * max);
    43274328
     
    43314332int sh_unix_getline_stealth (SL_TICKET fd, char * str, int len)
    43324333{
    4333   int                  add_off, llen;
    4334   static unsigned long off_data = 0;
    4335   static unsigned long max_data = 0;
     4334  int                  add_off = 0, llen;
     4335  static unsigned long off_data   = 0;
     4336  static unsigned long max_data   = 0;
     4337  static unsigned long bytes_read = 0;
    43364338  static int           stealth_init = BAD;
    43374339
     
    43584360  /* --- Seek to proper position. ---
    43594361   */
    4360   if (off_data >= max_data)
     4362  if (bytes_read >= max_data || add_off < 0)
    43614363    {
    43624364      dlog(1, FIL__, __LINE__,
     
    43704372  /* --- Read one line. ---
    43714373   */
    4372   add_off   = hideout_hex_block(fd, (unsigned char *) str, len);
     4374  add_off   = hideout_hex_block(fd, (unsigned char *) str, len, &bytes_read);
    43734375  off_data += add_off;
    43744376
     
    43774379}
    43784380
    4379 int hideout_hex_block(SL_TICKET fd, unsigned char * str, int len)
     4381int hideout_hex_block(SL_TICKET fd, unsigned char * str, int len,
     4382                      unsigned long * bytes_read)
    43804383{
    43814384
     
    43864389  unsigned long here   = 0;
    43874390  unsigned long retval = 0;
     4391  unsigned long bread  = 0;
    43884392
    43894393  SL_ENTER(_("hideout_hex_block"));
     
    44104414                  num = sl_read (fd, &c, 1);
    44114415                } while (num == 0 && errno == EINTR);
    4412                 if (num == 0)
     4416                if (num > 0)
     4417                  ++here;
     4418                else if (num == 0)
    44134419                  SL_RETURN((0), _("hideout_hex_block"));
    4414                 ++here;
     4420                else
     4421                  SL_RETURN((-1), _("hideout_hex_block"));
    44154422              } while (c == '\n' || c == '\t' || c == '\r' ||
    44164423                       c == ' ');
     
    44264433            str[i] &= ~mask[j];
    44274434
     4435          bread += 1;
    44284436        }
    44294437      if (str[i] == '\n') break;
     
    44364444    str[i+1] = '\0'; /* keep newline and terminate */
    44374445  retval += here;
     4446  *bytes_read += (bread/8);
    44384447
    44394448  SL_RETURN(retval, _("hideout_hex_block"));
  • trunk/test/testrun_1a.sh

    r27 r89  
    2020#
    2121
    22 BUILDOPTS="--quiet $TRUST --enable-debug --enable-xml-log --enable-micro-stealth=137 --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file"
    23 export BUILDOPTS
     22PREBUILDOPTS="--quiet $TRUST --enable-debug --enable-xml-log --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file"
     23export PREBUILDOPTS
     24
     25MAXTEST=1; export MAXTEST
     26
     27testrun_stealth ()
     28{
     29    tcount=14
     30
     31    if test -r "Makefile"; then
     32        $MAKE distclean >/dev/null
     33    fi
     34   
     35    ${TOP_SRCDIR}/configure ${BUILDOPTS}
     36   
     37    if test x$? = x0; then
     38        [ -z "$verbose" ] ||     log_msg_ok "configure...";
     39        $MAKE  >/dev/null 2>>test_log
     40        if test x$? = x0; then
     41            [ -z "$verbose" ] || log_msg_ok "make...";
     42        else
     43            [ -z "$quiet" ] &&   log_msg_fail "make...";
     44            return 1
     45        fi
     46       
     47    else
     48        [ -z "$quiet" ] &&       log_msg_fail "configure...";
     49        return 1
     50    fi
     51
     52    CONVERT=`find_path convert`
     53    if [ x"$CONVERT" = x ]; then
     54        [ -z "$verbose" ] || log_msg_fail "ImageMagick convert not found";
     55        return 1
     56    fi
     57    "$CONVERT" --help | grep  ImageMagick >/dev/null 2>&1
     58    if [ $? -ne 0 ]; then
     59        [ -z "$verbose" ] || log_msg_fail "Convert utility is not ImageMagick convert";
     60        return 1
     61    fi
     62    "${CONVERT}" +compress stealth_template.jpg stealth_template.ps
     63    if [ $? -ne 0 ]; then
     64        [ -z "$verbose" ] || log_msg_fail "Converting stealth_template.jpg failed";
     65        return 1
     66    fi
     67   
     68    $MAKE samhain_stealth >/dev/null 2>>test_log
     69    if [ $? -ne 0 ]; then
     70        [ -z "$verbose" ] || log_msg_fail "make samhain_stealth";
     71        return 1
     72    fi
     73    capacity=`./samhain_stealth -i stealth_template.ps | awk '{ print $7 }'`
     74
     75    prep_init
     76    check_err $? ${tcount}; errval=$?
     77    if [ $errval -eq 0 ]; then
     78        prep_testdata
     79        check_err $? ${tcount}; errval=$?
     80    fi
     81    if [ $errval -eq 0 ]; then
     82        prep_testpolicy   1
     83        check_err $? ${tcount}; errval=$?
     84    fi
     85
     86    if [ $errval -eq 0 ]; then
     87        fill=`cat "${RCFILE}" | wc -c`
     88        check_err $? ${tcount}; errval=$?
     89    fi
     90    if [ $errval -eq 0 ]; then
     91        let "capacity = capacity - fill" >/dev/null
     92        let "capacity = capacity - 100" >/dev/null
     93        until [ "$capacity" -le 0 ]
     94          do
     95          echo "###############################" >>"${RCFILE}"
     96          let "capacity = capacity - 32" >/dev/null
     97        done
     98
     99        ./samhain_stealth -s stealth_template.ps "${RCFILE}" >/dev/null
     100        check_err $? ${tcount}; errval=$?
     101    fi
     102    if [ $errval -eq 0 ]; then
     103        cp stealth_template.ps "${RCFILE}"
     104        check_err $? ${tcount}; errval=$?
     105    fi
     106
     107    if [ $errval -eq 0 ]; then
     108        run_init
     109        check_err $? ${tcount}; errval=$?
     110    fi
     111    if [ $errval -eq 0 ]; then
     112        eval mod_testdata_1
     113        check_err $? ${tcount}; errval=$?
     114    fi
     115    if [ $errval -eq 0 ]; then
     116        run_check
     117        check_err $? ${tcount}; errval=$?
     118    fi
     119    if [ $errval -eq 0 ]; then
     120        eval chk_testdata_1
     121        check_err $? ${tcount}; errval=$?
     122    fi
     123    if [ $testrun1_setup -eq 0 ]; then
     124        if [ $errval -eq 0 ]; then
     125            run_update
     126            check_err $? ${tcount}; errval=$?
     127        fi
     128        if [ $errval -eq 0 ]; then
     129            run_check_after_update
     130            check_err $? ${tcount}; errval=$?
     131        fi
     132    fi
     133
     134    if [ $errval -eq 0 ]; then
     135        [ -z "$quiet" ] && log_ok ${tcount} ${MAXTEST};
     136    fi
     137}
    24138
    25139testrun1a ()
    26140{
    27141    log_start "RUN STANDALONE W/STEALTH"
    28     testrun_internal
     142    #
     143    # micro-stealth
     144    #
     145    #BUILDOPTS="$PREBUILDOPTS --enable-micro-stealth=137"; export BUILDOPTS
     146    #testrun_internal
     147
     148    BUILDOPTS="$PREBUILDOPTS --enable-stealth=137"; export BUILDOPTS
     149    testrun_stealth
     150
    29151    log_end "RUN STANDALONE W/STEALTH"
    30152    return 0
Note: See TracChangeset for help on using the changeset viewer.