Changeset 30 for trunk


Ignore:
Timestamp:
Apr 27, 2006, 10:40:32 PM (18 years ago)
Author:
rainer
Message:

Release candidate 3 for version 2.2.0

Location:
trunk
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/COPYING

    r18 r30  
    131131
    132132  (vi) Support for the MD5 hash algorithm is provided by code
    133   from beecrypt which is distributed under the LGPL.
    134 
    135       /*
    136        * md5.c
    137        *
    138        * MD5 hash function, code
    139        *
    140        * Copyright (c) 2000 Virtual Unlimited B.V.
    141        *
    142        * Author: Bob Deblier <bob@virtualunlimited.com>
    143        *
    144        * This library is free software; you can redistribute it and/or
    145        * modify it under the terms of the GNU Lesser General Public
    146        * License as published by the Free Software Foundation; either
    147        * version 2.1 of the License, or (at your option) any later version.
    148        *
    149        * This library is distributed in the hope that it will be useful,
    150        * but WITHOUT ANY WARRANTY; without even the implied warranty of
    151        * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    152        * Lesser General Public License for more details.
    153        *
    154        * You should have received a copy of the GNU Lesser General Public
    155        * License along with this library; if not, write to the Free Software
    156        * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
    157        * USA
    158        */
     133  from busybox which is distributed under the GPL.
     134
     135   /* md5.c - Functions to compute MD5 message digest of files or memory blocks
     136    *         according to the definition of MD5 in RFC 1321 from April 1992.
     137    * Copyright (C) 1995, 1996 Free Software Foundation, Inc.
     138    *
     139    * NOTE: The canonical source of this file is maintained with the GNU C
     140    * Library.  Bugs can be reported to bug-glibc@prep.ai.mit.edu.
     141    *
     142    * This program is free software; you can redistribute it and/or modify it
     143    * under the terms of the GNU General Public License as published by the
     144    * Free Software Foundation; either version 2, or (at your option) any
     145    * later version.
     146    *
     147    * This program is distributed in the hope that it will be useful,
     148    * but WITHOUT ANY WARRANTY; without even the implied warranty of
     149    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     150    * GNU General Public License for more details.
     151    *
     152    * You should have received a copy of the GNU General Public License
     153    * along with this program; if not, write to the Free Software Foundation,
     154    * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
     155    */
     156
     157   /* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.  */
     158
    159159
    160160  (vi) Support for the SHA-1 hash algorithm is provided by code
  • trunk/configure.ac

    r26 r30  
    3737dnl start
    3838dnl
    39 AM_INIT_AUTOMAKE(samhain, 2.2.0rc1)
     39AM_INIT_AUTOMAKE(samhain, 2.2.0rc3)
    4040AC_CANONICAL_HOST
    4141
  • trunk/docs/Changelog

    r29 r30  
    112.2.0:
     2        * patch by Jim Simmons for samhainadmin.pl.in
     3        * fix testsuite portability problems
     4        * fix md5 endianess problem detected on HP-UX 11i / PA-RISC 8700
     5        * fix potential NULL dereference in sh_utmp_endutent()
    26        * patch by Neil Gorsuch for suidchk.c (do not scan lustre, afs, mmfs)
    37        * fix sh_ext_popen (OpenBSD needs non-null argv[0] in execve)
  • trunk/include/samhain.h

    r27 r30  
    301301/* signal-safe log function
    302302 */
    303 int safe_logger (int signal, int method, char * details);
    304 int safe_fatal  (int signal, int method, char * details, char *f, int l);
     303int  safe_logger (int signal, int method, char * details);
     304void safe_fatal  (int signal, int method, char * details, char *f, int l);
    305305
    306306#define SH_VALIDATE_EQ(a,b) \
  • trunk/scripts/samhainadmin.pl.in

    r3 r30  
    2929use Fcntl qw(:DEFAULT :flock);
    3030
     31# Do I/O to the data file in binary mode (so it
     32# wouldn't complain about invalid UTF-8 characters).
     33use bytes;
     34
    3135File::Temp->safe_level( File::Temp::HIGH );
    3236
     
    515519    $action = 'f';
    516520}
    517 elsif (defined ($opts{'create-cfgfile'})) {
     521elsif (defined ($opts{'create-datafile'})) {
    518522    $action = 'D';
    519523}
    520 elsif (defined ($opts{'print-cfgfile'})) {
     524elsif (defined ($opts{'print-datafile'})) {
    521525    $action = 'd';
    522526}
  • trunk/src/cutest_sh_unix.c

    r24 r30  
    99void Test_sh_unix_lookup_page (CuTest *tc) {
    1010
    11   int pagesize = sh_unix_pagesize();
     11  long pagesize = sh_unix_pagesize();
    1212 
    13   unsigned int base;
     13  unsigned long base;
    1414  int          num_pages;
    1515
  • trunk/src/sh_database.c

    r27 r30  
    225225typedef unsigned char uint8;
    226226
    227 typedef struct
    228 {
    229         uint32 h[4];
    230         uint32 data[16];
    231         uint8  offset;
    232         uint32  nblocks;
    233         int  count;
     227typedef struct md5_ctx
     228{
     229  uint32 A;
     230  uint32 B;
     231  uint32 C;
     232  uint32 D;
     233
     234  uint32 total[2];
     235  uint32 buflen;
     236  char buffer[128];
    234237} md5Param;
    235 
    236238
    237239
  • trunk/src/sh_entropy.c

    r22 r30  
    478478static
    479479char   * com_path[] = {
     480  N_("/usr/bin/xpg4/"),
    480481  N_("/usr/ucb/"),
    481482  N_("/bin/"),
  • trunk/src/sh_suidchk.c

    r29 r30  
    524524               */
    525525              fs = filesystem_type (tmpcat, tmpcat, &buf);
    526               if (fs != NULL &&
     526              if (fs != NULL
     527#ifndef SH_SUIDTESTDIR
     528                  &&
    527529                  0 != strncmp (_("afs"),     fs, 3) &&
    528530                  0 != strncmp (_("devfs"),   fs, 5) &&
     
    534536                  0 != strncmp (_("nosuid"),  fs, 6) &&
    535537                  0 != strncmp (_("proc"),    fs, 4) &&
    536                   0 != strncmp (_("vfat"),    fs, 4)
     538                  0 != strncmp (_("vfat"),    fs, 4)
     539#endif
    537540                  )
    538541                {
  • trunk/src/sh_tiger0.c

    r22 r30  
    404404#ifdef USE_MD5
    405405/*@-type@*/
    406 /************************************************************************
     406/* md5.c - Functions to compute MD5 message digest of files or memory blocks
     407 *         according to the definition of MD5 in RFC 1321 from April 1992.
     408 * Copyright (C) 1995, 1996 Free Software Foundation, Inc.
    407409 *
    408  *  md5.h - Declaration of functions and data types used for MD5 sum
    409  *  computing library functions.
     410 * NOTE: The canonical source of this file is maintained with the GNU C
     411 * Library.  Bugs can be reported to bug-glibc@prep.ai.mit.edu.
    410412 *
    411  ************************************************************************/
    412 
    413 /* Written Bob Deblier <bob@virtualunlimited.com>         */
     413 * This program is free software; you can redistribute it and/or modify it
     414 * under the terms of the GNU General Public License as published by the
     415 * Free Software Foundation; either version 2, or (at your option) any
     416 * later version.
     417 *
     418 * This program is distributed in the hope that it will be useful,
     419 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     420 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     421 * GNU General Public License for more details.
     422 *
     423 * You should have received a copy of the GNU General Public License
     424 * along with this program; if not, write to the Free Software Foundation,
     425 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
     426 */
     427
     428/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.  */
     429
    414430/* Hacked to work with samhain by R. Wichmann             */
    415 /* Need for 64bit type removed, fix for Mac OS X compiler */
    416 
    417 typedef sh_word32     uint32;
    418 typedef unsigned char uint8;
    419 
    420 
    421 
     431
     432typedef UINT32 md5_uint32;
    422433
    423434
    424435/* Structure to save state of computation between the single steps.  */
    425 typedef struct
    426 {
    427         uint32 h[4];
    428         uint32 data[16];
    429         uint8  offset;
    430         uint32  nblocks;
    431         int  count;
     436typedef struct md5_ctx
     437{
     438  md5_uint32 A;
     439  md5_uint32 B;
     440  md5_uint32 C;
     441  md5_uint32 D;
     442
     443  md5_uint32 total[2];
     444  md5_uint32 buflen;
     445  char buffer[128];
    432446} md5Param;
    433447
    434 static uint32 md5hinit[4] = { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 };
     448/*
     449 * The following three functions are build up the low level used in
     450 * the functions `md5_stream' and `md5_buffer'.
     451 */
     452
     453/* Initialize structure containing state of computation.
     454   (RFC 1321, 3.3: Step 3)  */
     455static void md5_init_ctx (struct md5_ctx *ctx);
     456
     457/* Starting with the result of former calls of this function (or the
     458   initialization function update the context for the next LEN bytes
     459   starting at BUFFER.
     460   It is necessary that LEN is a multiple of 64!!! */
     461static void md5_process_block (const void *buffer, size_t len,
     462                                    struct md5_ctx *ctx);
     463
     464/* Starting with the result of former calls of this function (or the
     465   initialization function update the context for the next LEN bytes
     466   starting at BUFFER.
     467   It is NOT required that LEN is a multiple of 64.  */
     468static void md5_process_bytes (const void *buffer, size_t len,
     469                                    struct md5_ctx *ctx);
     470
     471/* Process the remaining bytes in the buffer and put result from CTX
     472   in first 16 bytes following RESBUF.  The result is always in little
     473   endian byte order, so that a byte-wise output yields to the wanted
     474   ASCII representation of the message digest.
     475
     476   IMPORTANT: On some systems it is required that RESBUF is correctly
     477   aligned for a 32 bits value.  */
     478static void *md5_finish_ctx (struct md5_ctx *ctx, void *resbuf);
     479
     480
     481/* Put result from CTX in first 16 bytes following RESBUF.  The result is
     482   always in little endian byte order, so that a byte-wise output yields
     483   to the wanted ASCII representation of the message digest.
     484
     485   IMPORTANT: On some systems it is required that RESBUF is correctly
     486   aligned for a 32 bits value.  */
     487static void *md5_read_ctx (const struct md5_ctx *ctx, void *resbuf);
     488
     489#if WORDS_BIGENDIAN
     490static md5_uint32 swapu32(md5_uint32 n)
     491{
     492  return (    ((n & 0xffU) << 24) |
     493              ((n & 0xff00U) << 8) |
     494              ((n & 0xff0000U) >> 8) |
     495              ((n & 0xff000000U) >> 24) );
     496}
     497#define SWAP(n) swapu32(n)
     498#else
     499#define SWAP(n) (n)
     500#endif
     501
     502/* This array contains the bytes used to pad the buffer to the next
     503   64-byte boundary.  (RFC 1321, 3.1: Step 1)  */
     504static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ...  */  };
     505
     506/* Initialize structure containing state of computation.
     507   (RFC 1321, 3.3: Step 3)  */
     508static void md5_init_ctx(struct md5_ctx *ctx)
     509{
     510  ctx->A = 0x67452301;
     511  ctx->B = 0xefcdab89;
     512  ctx->C = 0x98badcfe;
     513  ctx->D = 0x10325476;
     514
     515  ctx->total[0] = ctx->total[1] = 0;
     516  ctx->buflen = 0;
     517}
     518
     519/* Put result from CTX in first 16 bytes following RESBUF.  The result
     520   must be in little endian byte order.
     521
     522   IMPORTANT: On some systems it is required that RESBUF is correctly
     523   aligned for a 32 bits value.  */
     524static void *md5_read_ctx(const struct md5_ctx *ctx, void *resbuf)
     525{
     526  ((md5_uint32 *) resbuf)[0] = SWAP(ctx->A);
     527  ((md5_uint32 *) resbuf)[1] = SWAP(ctx->B);
     528  ((md5_uint32 *) resbuf)[2] = SWAP(ctx->C);
     529  ((md5_uint32 *) resbuf)[3] = SWAP(ctx->D);
     530
     531  return resbuf;
     532}
     533
     534/* Process the remaining bytes in the internal buffer and the usual
     535   prolog according to the standard and write the result to RESBUF.
     536
     537   IMPORTANT: On some systems it is required that RESBUF is correctly
     538   aligned for a 32 bits value.  */
     539static void *md5_finish_ctx(struct md5_ctx *ctx, void *resbuf)
     540{
     541  /* Take yet unprocessed bytes into account.  */
     542  md5_uint32 bytes = ctx->buflen;
     543  size_t pad;
     544
     545  /* Now count remaining bytes.  */
     546  ctx->total[0] += bytes;
     547  if (ctx->total[0] < bytes)
     548    ++ctx->total[1];
     549
     550  pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes;
     551  memcpy(&ctx->buffer[bytes], fillbuf, pad);
     552
     553  /* Put the 64-bit file length in *bits* at the end of the buffer.  */
     554  *(md5_uint32 *) & ctx->buffer[bytes + pad] = SWAP(ctx->total[0] << 3);
     555  *(md5_uint32 *) & ctx->buffer[bytes + pad + 4] =
     556    SWAP((ctx->total[1] << 3) | (ctx->total[0] >> 29));
     557
     558  /* Process last bytes.  */
     559  md5_process_block(ctx->buffer, bytes + pad + 8, ctx);
     560
     561  return md5_read_ctx(ctx, resbuf);
     562}
     563
     564/* Compute MD5 message digest for LEN bytes beginning at BUFFER.  The
     565   result is always in little endian byte order, so that a byte-wise
     566   output yields to the wanted ASCII representation of the message
     567   digest.  */
     568void *md5_buffer(const char *buffer, size_t len, void *resblock)
     569{
     570  struct md5_ctx ctx;
     571
     572  /* Initialize the computation context.  */
     573  md5_init_ctx(&ctx);
     574
     575  /* Process whole buffer but last len % 64 bytes.  */
     576  md5_process_bytes(buffer, len, &ctx);
     577
     578  /* Put result in desired memory area.  */
     579  return md5_finish_ctx(&ctx, resblock);
     580}
     581
     582static void md5_process_bytes(const void *buffer, size_t len, struct md5_ctx *ctx)
     583{
     584  /* When we already have some bits in our internal buffer concatenate
     585     both inputs first.  */
     586  if (ctx->buflen != 0) {
     587    size_t left_over = ctx->buflen;
     588    size_t add = 128 - left_over > len ? len : 128 - left_over;
     589
     590    memcpy(&ctx->buffer[left_over], buffer, add);
     591    ctx->buflen += add;
     592
     593    if (left_over + add > 64) {
     594      md5_process_block(ctx->buffer, (left_over + add) & ~63, ctx);
     595      /* The regions in the following copy operation cannot overlap.  */
     596      memcpy(ctx->buffer, &ctx->buffer[(left_over + add) & ~63],
     597             (left_over + add) & 63);
     598      ctx->buflen = (left_over + add) & 63;
     599    }
     600
     601    buffer = (const char *) buffer + add;
     602    len -= add;
     603  }
     604
     605  /* Process available complete blocks.  */
     606  if (len > 64) {
     607    md5_process_block(buffer, len & ~63, ctx);
     608    buffer = (const char *) buffer + (len & ~63);
     609    len &= 63;
     610  }
     611
     612  /* Move remaining bytes in internal buffer.  */
     613  if (len > 0) {
     614    memcpy(ctx->buffer, buffer, len);
     615    ctx->buflen = len;
     616  }
     617}
     618
     619/* These are the four functions used in the four steps of the MD5 algorithm
     620   and defined in the RFC 1321.  The first function is a little bit optimized
     621   (as found in Colin Plumbs public domain implementation).  */
     622/* #define FF(b, c, d) ((b & c) | (~b & d)) */
     623#define FF(b, c, d) (d ^ (b & (c ^ d)))
     624#define FG(b, c, d) FF (d, b, c)
     625#define FH(b, c, d) (b ^ c ^ d)
     626#define FI(b, c, d) (c ^ (b | ~d))
     627
     628/* Process LEN bytes of BUFFER, accumulating context into CTX.
     629   It is assumed that LEN % 64 == 0.  */
     630static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx)
     631{
     632  md5_uint32 correct_words[16];
     633  const md5_uint32 *words = buffer;
     634  size_t nwords = len / sizeof(md5_uint32);
     635  const md5_uint32 *endp = words + nwords;
     636  md5_uint32 A = ctx->A;
     637  md5_uint32 B = ctx->B;
     638  md5_uint32 C = ctx->C;
     639  md5_uint32 D = ctx->D;
     640
     641  /* First increment the byte count.  RFC 1321 specifies the possible
     642     length of the file up to 2^64 bits.  Here we only compute the
     643     number of bytes.  Do a double word increment.  */
     644  ctx->total[0] += len;
     645  if (ctx->total[0] < len)
     646    ++ctx->total[1];
     647
     648  /* Process all bytes in the buffer with 64 bytes in each round of
     649     the loop.  */
     650  while (words < endp) {
     651    md5_uint32 *cwp = correct_words;
     652    md5_uint32 A_save = A;
     653    md5_uint32 B_save = B;
     654    md5_uint32 C_save = C;
     655    md5_uint32 D_save = D;
     656
     657    /* First round: using the given function, the context and a constant
     658       the next context is computed.  Because the algorithms processing
     659       unit is a 32-bit word and it is determined to work on words in
     660       little endian byte order we perhaps have to change the byte order
     661       before the computation.  To reduce the work for the next steps
     662       we store the swapped words in the array CORRECT_WORDS.  */
     663
     664#define OP(a, b, c, d, s, T)                                            \
     665      do                                                                \
     666        {                                                               \
     667          a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T;             \
     668          ++words;                                                      \
     669          CYCLIC (a, s);                                                \
     670          a += b;                                                       \
     671        }                                                               \
     672      while (0)
     673
     674    /* It is unfortunate that C does not provide an operator for
     675       cyclic rotation.  Hope the C compiler is smart enough.  */
     676#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s)))
     677
     678    /* Before we start, one word to the strange constants.
     679       They are defined in RFC 1321 as
     680
     681       T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64
     682    */
     683
     684    /* Round 1.  */
     685    OP(A, B, C, D, 7, 0xd76aa478);
     686    OP(D, A, B, C, 12, 0xe8c7b756);
     687    OP(C, D, A, B, 17, 0x242070db);
     688    OP(B, C, D, A, 22, 0xc1bdceee);
     689    OP(A, B, C, D, 7, 0xf57c0faf);
     690    OP(D, A, B, C, 12, 0x4787c62a);
     691    OP(C, D, A, B, 17, 0xa8304613);
     692    OP(B, C, D, A, 22, 0xfd469501);
     693    OP(A, B, C, D, 7, 0x698098d8);
     694    OP(D, A, B, C, 12, 0x8b44f7af);
     695    OP(C, D, A, B, 17, 0xffff5bb1);
     696    OP(B, C, D, A, 22, 0x895cd7be);
     697    OP(A, B, C, D, 7, 0x6b901122);
     698    OP(D, A, B, C, 12, 0xfd987193);
     699    OP(C, D, A, B, 17, 0xa679438e);
     700    OP(B, C, D, A, 22, 0x49b40821);
     701    /* For the second to fourth round we have the possibly swapped words
     702       in CORRECT_WORDS.  Redefine the macro to take an additional first
     703       argument specifying the function to use.  */
     704#undef OP
     705#define OP(f, a, b, c, d, k, s, T)                                      \
     706      do                                                                \
     707        {                                                               \
     708          a += f (b, c, d) + correct_words[k] + T;                      \
     709          CYCLIC (a, s);                                                \
     710          a += b;                                                       \
     711        }                                                               \
     712      while (0)
     713
     714    /* Round 2.  */
     715    OP(FG, A, B, C, D, 1, 5, 0xf61e2562);
     716    OP(FG, D, A, B, C, 6, 9, 0xc040b340);
     717    OP(FG, C, D, A, B, 11, 14, 0x265e5a51);
     718    OP(FG, B, C, D, A, 0, 20, 0xe9b6c7aa);
     719    OP(FG, A, B, C, D, 5, 5, 0xd62f105d);
     720    OP(FG, D, A, B, C, 10, 9, 0x02441453);
     721    OP(FG, C, D, A, B, 15, 14, 0xd8a1e681);
     722    OP(FG, B, C, D, A, 4, 20, 0xe7d3fbc8);
     723    OP(FG, A, B, C, D, 9, 5, 0x21e1cde6);
     724    OP(FG, D, A, B, C, 14, 9, 0xc33707d6);
     725    OP(FG, C, D, A, B, 3, 14, 0xf4d50d87);
     726    OP(FG, B, C, D, A, 8, 20, 0x455a14ed);
     727    OP(FG, A, B, C, D, 13, 5, 0xa9e3e905);
     728    OP(FG, D, A, B, C, 2, 9, 0xfcefa3f8);
     729    OP(FG, C, D, A, B, 7, 14, 0x676f02d9);
     730    OP(FG, B, C, D, A, 12, 20, 0x8d2a4c8a);
     731
     732    /* Round 3.  */
     733    OP(FH, A, B, C, D, 5, 4, 0xfffa3942);
     734    OP(FH, D, A, B, C, 8, 11, 0x8771f681);
     735    OP(FH, C, D, A, B, 11, 16, 0x6d9d6122);
     736    OP(FH, B, C, D, A, 14, 23, 0xfde5380c);
     737    OP(FH, A, B, C, D, 1, 4, 0xa4beea44);
     738    OP(FH, D, A, B, C, 4, 11, 0x4bdecfa9);
     739    OP(FH, C, D, A, B, 7, 16, 0xf6bb4b60);
     740    OP(FH, B, C, D, A, 10, 23, 0xbebfbc70);
     741    OP(FH, A, B, C, D, 13, 4, 0x289b7ec6);
     742    OP(FH, D, A, B, C, 0, 11, 0xeaa127fa);
     743    OP(FH, C, D, A, B, 3, 16, 0xd4ef3085);
     744    OP(FH, B, C, D, A, 6, 23, 0x04881d05);
     745    OP(FH, A, B, C, D, 9, 4, 0xd9d4d039);
     746    OP(FH, D, A, B, C, 12, 11, 0xe6db99e5);
     747    OP(FH, C, D, A, B, 15, 16, 0x1fa27cf8);
     748    OP(FH, B, C, D, A, 2, 23, 0xc4ac5665);
     749
     750    /* Round 4.  */
     751    OP(FI, A, B, C, D, 0, 6, 0xf4292244);
     752    OP(FI, D, A, B, C, 7, 10, 0x432aff97);
     753    OP(FI, C, D, A, B, 14, 15, 0xab9423a7);
     754    OP(FI, B, C, D, A, 5, 21, 0xfc93a039);
     755    OP(FI, A, B, C, D, 12, 6, 0x655b59c3);
     756    OP(FI, D, A, B, C, 3, 10, 0x8f0ccc92);
     757    OP(FI, C, D, A, B, 10, 15, 0xffeff47d);
     758    OP(FI, B, C, D, A, 1, 21, 0x85845dd1);
     759    OP(FI, A, B, C, D, 8, 6, 0x6fa87e4f);
     760    OP(FI, D, A, B, C, 15, 10, 0xfe2ce6e0);
     761    OP(FI, C, D, A, B, 6, 15, 0xa3014314);
     762    OP(FI, B, C, D, A, 13, 21, 0x4e0811a1);
     763    OP(FI, A, B, C, D, 4, 6, 0xf7537e82);
     764    OP(FI, D, A, B, C, 11, 10, 0xbd3af235);
     765    OP(FI, C, D, A, B, 2, 15, 0x2ad7d2bb);
     766    OP(FI, B, C, D, A, 9, 21, 0xeb86d391);
     767
     768    /* Add the starting values of the context.  */
     769    A += A_save;
     770    B += B_save;
     771    C += C_save;
     772    D += D_save;
     773  }
     774
     775  /* Put checksum in context given as argument.  */
     776  ctx->A = A;
     777  ctx->B = B;
     778  ctx->C = C;
     779  ctx->D = D;
     780}
     781
     782
     783/*----------------------------------------------------------------------------
     784 *--------end of md5.c
     785 *----------------------------------------------------------------------------*/
    435786
    436787 
     
    438789{
    439790        unsigned int i;
    440         memcpy(p->h, md5hinit, 16);
     791
     792        md5_init_ctx(p);
    441793       
    442794        for (i = 0; i < 16; i += 8)
    443795          {
    444             p->data[i]   = 0x00;
    445             p->data[i+1] = 0x00;
    446             p->data[i+2] = 0x00;
    447             p->data[i+3] = 0x00;
    448             p->data[i+4] = 0x00;
    449             p->data[i+5] = 0x00;
    450             p->data[i+6] = 0x00;
    451             p->data[i+7] = 0x00;
     796            p->buffer[i]   = 0x00;
     797            p->buffer[i+1] = 0x00;
     798            p->buffer[i+2] = 0x00;
     799            p->buffer[i+3] = 0x00;
     800            p->buffer[i+4] = 0x00;
     801            p->buffer[i+5] = 0x00;
     802            p->buffer[i+6] = 0x00;
     803            p->buffer[i+7] = 0x00;
    452804          }
    453805       
    454         /* memset(p->data, 0x00, 64); */
    455         p->offset = (uint8) 0;
    456         p->nblocks = 0;
    457806        return 0;
    458807}
    459808
    460 #if defined(__GNUC__) && defined(__i386__)
    461 static inline UINT32
    462 ROTL32( UINT32 x, int s)
    463 {
    464         __asm__("roll %%cl,%0"
    465                 :"=r" (x)
    466                 :"0" (x),"c" (s));
    467         return x;
    468 }
    469 #else
    470 #define ROTL32(x, s) (((x) << (s)) | ((x) >> (32 - (s))))
    471 #endif
    472 
    473 
    474 #define FF(a, b, c, d, w, s, t) \
    475         a += ((b&(c^d))^d) + w + t;     \
    476         a = ROTL32(a, s);       \
    477         a += b;
    478 
    479 #define GG(a, b, c, d, w, s, t) \
    480         a += ((d&(b^c))^c) + w + t;     \
    481         a = ROTL32(a, s);       \
    482         a += b;
    483 
    484 #define HH(a, b, c, d, w, s, t) \
    485         a += (b^c^d) + w + t;   \
    486         a = ROTL32(a, s);       \
    487         a += b;
    488 
    489 #define II(a, b, c, d, w, s, t) \
    490         a += (c^(b|~d)) + w + t;        \
    491         a = ROTL32(a, s);       \
    492         a += b;
    493 
    494 #if WORDS_BIGENDIAN
    495 uint32 swapu32(uint32 n)
    496 {
    497         return (    ((n & 0xffU) << 24) |
    498                                 ((n & 0xff00U) << 8) |
    499                                 ((n & 0xff0000U) >> 8) |
    500                                 ((n & 0xff000000U) >> 24) );
    501 }
    502 #endif
    503 
    504 static
    505 void md5Process(md5Param* p)
    506 {
    507         register uint32 a,b,c,d;
    508         register uint32* w;
    509         #if WORDS_BIGENDIAN
    510         register sh_byte t;
    511         #endif
    512 
    513         w = p->data;
    514         #if WORDS_BIGENDIAN
    515         t = 16;
    516         while (t--)
    517         {
    518                 register uint32 temp = swapu32(*w);
    519                 *(w++) = temp;
    520         }
    521         w = p->data;
    522         #endif
    523 
    524         a = p->h[0]; b = p->h[1]; c = p->h[2]; d = p->h[3];
    525 
    526         FF(a, b, c, d, (*w++),  7, 0xd76aa478);
    527         FF(d, a, b, c, (*w++), 12, 0xe8c7b756);
    528         FF(c, d, a, b, (*w++), 17, 0x242070db);
    529         FF(b, c, d, a, (*w++), 22, 0xc1bdceee);
    530         FF(a, b, c, d, (*w++),  7, 0xf57c0faf);
    531         FF(d, a, b, c, (*w++), 12, 0x4787c62a);
    532         FF(c, d, a, b, (*w++), 17, 0xa8304613);
    533         FF(b, c, d, a, (*w++), 22, 0xfd469501);
    534         FF(a, b, c, d, (*w++),  7, 0x698098d8);
    535         FF(d, a, b, c, (*w++), 12, 0x8b44f7af);
    536         FF(c, d, a, b, (*w++), 17, 0xffff5bb1);
    537         FF(b, c, d, a, (*w++), 22, 0x895cd7be);
    538         FF(a, b, c, d, (*w++),  7, 0x6b901122);
    539         FF(d, a, b, c, (*w++), 12, 0xfd987193);
    540         FF(c, d, a, b, (*w++), 17, 0xa679438e);
    541         FF(b, c, d, a, (*w++), 22, 0x49b40821);
    542 
    543         w = p->data;
    544 
    545         GG(a, b, c, d, w[ 1],  5, 0xf61e2562);
    546         GG(d, a, b, c, w[ 6],  9, 0xc040b340);
    547         GG(c, d, a, b, w[11], 14, 0x265e5a51);
    548         GG(b, c, d, a, w[ 0], 20, 0xe9b6c7aa);
    549         GG(a, b, c, d, w[ 5],  5, 0xd62f105d);
    550         GG(d, a, b, c, w[10],  9, 0x02441453);
    551         GG(c, d, a, b, w[15], 14, 0xd8a1e681);
    552         GG(b, c, d, a, w[ 4], 20, 0xe7d3fbc8);
    553         GG(a, b, c, d, w[ 9],  5, 0x21e1cde6);
    554         GG(d, a, b, c, w[14],  9, 0xc33707d6);
    555         GG(c, d, a, b, w[ 3], 14, 0xf4d50d87);
    556         GG(b, c, d, a, w[ 8], 20, 0x455a14ed);
    557         GG(a, b, c, d, w[13],  5, 0xa9e3e905);
    558         GG(d, a, b, c, w[ 2],  9, 0xfcefa3f8);
    559         GG(c, d, a, b, w[ 7], 14, 0x676f02d9);
    560         GG(b, c, d, a, w[12], 20, 0x8d2a4c8a);
    561 
    562         HH(a, b, c, d, w[ 5],  4, 0xfffa3942);
    563         HH(d, a, b, c, w[ 8], 11, 0x8771f681);
    564         HH(c, d, a, b, w[11], 16, 0x6d9d6122);
    565         HH(b, c, d, a, w[14], 23, 0xfde5380c);
    566         HH(a, b, c, d, w[ 1],  4, 0xa4beea44);
    567         HH(d, a, b, c, w[ 4], 11, 0x4bdecfa9);
    568         HH(c, d, a, b, w[ 7], 16, 0xf6bb4b60);
    569         HH(b, c, d, a, w[10], 23, 0xbebfbc70);
    570         HH(a, b, c, d, w[13],  4, 0x289b7ec6);
    571         HH(d, a, b, c, w[ 0], 11, 0xeaa127fa);
    572         HH(c, d, a, b, w[ 3], 16, 0xd4ef3085);
    573         HH(b, c, d, a, w[ 6], 23, 0x04881d05);
    574         HH(a, b, c, d, w[ 9],  4, 0xd9d4d039);
    575         HH(d, a, b, c, w[12], 11, 0xe6db99e5);
    576         HH(c, d, a, b, w[15], 16, 0x1fa27cf8);
    577         HH(b, c, d, a, w[ 2], 23, 0xc4ac5665);
    578 
    579         II(a, b, c, d, w[ 0],  6, 0xf4292244);
    580         II(d, a, b, c, w[ 7], 10, 0x432aff97);
    581         II(c, d, a, b, w[14], 15, 0xab9423a7);
    582         II(b, c, d, a, w[ 5], 21, 0xfc93a039);
    583         II(a, b, c, d, w[12],  6, 0x655b59c3);
    584         II(d, a, b, c, w[ 3], 10, 0x8f0ccc92);
    585         II(c, d, a, b, w[10], 15, 0xffeff47d);
    586         II(b, c, d, a, w[ 1], 21, 0x85845dd1);
    587         II(a, b, c, d, w[ 8],  6, 0x6fa87e4f);
    588         II(d, a, b, c, w[15], 10, 0xfe2ce6e0);
    589         II(c, d, a, b, w[ 6], 15, 0xa3014314);
    590         II(b, c, d, a, w[13], 21, 0x4e0811a1);
    591         II(a, b, c, d, w[ 4],  6, 0xf7537e82);
    592         II(d, a, b, c, w[11], 10, 0xbd3af235);
    593         II(c, d, a, b, w[ 2], 15, 0x2ad7d2bb);
    594         II(b, c, d, a, w[ 9], 21, 0xeb86d391);
    595 
    596         p->h[0] += a;
    597         p->h[1] += b;
    598         p->h[2] += c;
    599         p->h[3] += d;
    600 }
    601 
    602809int md5Update(md5Param* p, const sh_byte* data, int size)
    603810{
    604         register int proclength;
    605 
    606         while (size > 0)
    607         {
    608           proclength = (((int)p->offset + size) > 64) ?
    609             (64 - (int)p->offset) : size;
    610           memcpy(((sh_byte *) p->data) + p->offset, data, (size_t) proclength);
    611           size -= proclength;
    612           data += proclength;
    613           p->offset += proclength;
    614          
    615           if (p->offset == (uint8) 64)
    616             {
    617               md5Process(p);
    618               p->offset = (uint8) 0;
    619               p->nblocks++;
    620             }
    621         }
    622         return 0;
    623 }
    624 
    625 static void md5Finish(md5Param* p)
    626 {
    627         uint32 t, msb, lsb;
    628         uint8 * pp;
    629         register uint8 *ptr;
    630 
    631         msb = 0;
    632         t = p->nblocks;
    633         if( (lsb = t << 6) < t ) /* multiply by 64 to make a byte count */
    634           msb++;
    635         msb += t >> 26;
    636         t = lsb;
    637         if( (lsb = t + (uint32)p->offset) < t ) /* add the count */
    638           msb++;
    639         t = lsb;
    640         if( (lsb = t << 3) < t ) /* multiply by 8 to make a bit count */
    641           msb++;
    642         msb += t >> 29;
    643 
    644         ptr = ((uint8 *) p->data) + p->offset++;
    645 
    646  
    647         *(ptr++) = (uint8) 0x80;
    648 
    649         if (p->offset > (uint8)56)
    650         {
    651                 while (p->offset++ < 64)
    652                         *(ptr++) = 0;
    653 
    654                 md5Process(p);
    655                 p->offset = 0;
    656         }
    657 
    658         ptr = ((uint8 *) p->data) + p->offset;
    659         while (p->offset++ < 56)
    660                 *(ptr++) = 0;
    661 
    662         /* append the 64 bit count */
    663         *(ptr++) = lsb     ;
    664         *(ptr++) = lsb >>  8;
    665         *(ptr++) = lsb >> 16;
    666         *(ptr++) = lsb >> 24;
    667         *(ptr++) = msb     ;
    668         *(ptr++) = msb >>  8;
    669         *(ptr++) = msb >> 16;
    670         *(ptr++) = msb >> 24;
    671 
    672         md5Process(p);
    673 
    674         pp = (uint8 *) p->data;
    675 #ifdef WORDS_BIGENDIAN
    676 #define X(a) do { *pp++ = (*p).a; *pp++ = (*p).a >> 8;      \
    677                   *pp++ = (*p).a >> 16; *pp++ = (*p).a >> 24; } while(0)
    678 #else /* little endian */
    679     /*#define X(a) do { *(uint32*)p = p->##a ; p += 4; } while(0)*/
    680     /* Unixware's cpp doesn't like the above construct so we do it his way:
    681      * (reported by Allan Clark) */
    682 #define X(a) do { *(uint32*)pp = (*p).a ; pp += 4; } while(0)
    683 #endif
    684         X(h[0]);
    685         X(h[1]);
    686         X(h[2]);
    687         X(h[3]);
    688 #undef X
    689 
    690         p->offset = 0;
    691 }
    692 
    693 int md5Digest(md5Param* p, uint32* data)
    694 {
    695         md5Finish(p);
    696         memcpy(data, p->h, 16);
     811  md5_process_bytes(data, size, p);
     812  return 0;
     813}
     814
     815static void md5Finish(md5Param* p, void *resblock)
     816{
     817  (void) md5_finish_ctx(p, resblock);
     818}
     819
     820int md5Digest(md5Param* p, md5_uint32* data)
     821{
     822        md5Finish(p, data);
    697823        (void) md5Reset(p);
    698824        return 0;
    699825}
    700826/*@+type@*/
     827
    701828
    702829/* Compute MD5 message digest for bytes read from STREAM.  The
     
    708835  /* Important: BLOCKSIZE must be a multiple of 64.  */
    709836  static const int BLOCKSIZE = 8192;
    710   md5Param ctx;
     837  struct md5_ctx ctx;
    711838  char buffer[8264]; /* BLOCKSIZE + 72  AIX compiler chokes */
    712   off_t sum = 0;
     839  size_t sum;
     840
    713841  SL_TICKET  fd;
    714842  char * tmp;
     
    797925       BLOCKSIZE % 64 == 0
    798926    */
    799     (void) md5Update(&ctx, (sh_byte*) buffer, BLOCKSIZE);
     927    md5_process_block(buffer, BLOCKSIZE, &ctx);
    800928    sh.statistics.bytes_hashed += BLOCKSIZE;
    801929
     
    816944  if (sum > 0)
    817945    {
    818       (void) md5Update(&ctx, (sh_byte*) buffer, (int) sum);
     946      md5_process_bytes(buffer, sum, &ctx);
    819947      sh.statistics.bytes_hashed += BLOCKSIZE;
    820948    }
  • trunk/src/sh_tools.c

    r27 r30  
    127127  unsigned char c, d;
    128128  const  char * p;
    129   char   *q;
    130129  char   tmp[4];
    131130  char * outstr;
     
    147146
    148147  p = instr;
    149   q = outstr;
    150148
    151149#if !defined(SH_USE_XML)
  • trunk/src/sh_unix.c

    r29 r30  
    429429}
    430430
    431 int safe_fatal (int signal, int method, char * details,
     431void safe_fatal (int signal, int method, char * details,
    432432                char * file, int line)
    433433{
  • trunk/src/sh_utmp.c

    r1 r30  
    331331{
    332332  SL_ENTER(_("sh_utmp_endutent"));
    333   (void) fclose(sh_utmpfile);
     333  if (NULL != sh_utmpfile)
     334    (void) fclose(sh_utmpfile);
    334335  sh_utmpfile = NULL;
    335336  SL_RET0(_("sh_utmp_endutent"));
  • trunk/test/test.sh

    r29 r30  
    1919# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    2020#
     21
     22# -----------------------------------------------------------------------
     23# Be Bourne compatible
     24# -----------------------------------------------------------------------
     25
     26if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
     27  emulate sh
     28  NULLCMD=:
     29elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
     30  set -o posix
     31fi
     32
     33# -----------------------------------------------------------------------
     34# Make sure we support functions (from the autoconf manual)
     35# -----------------------------------------------------------------------
     36
     37TSHELL="${TSHELL-/bin/sh}"
     38if test x"$1" = "x--re-executed"
     39then
     40    shift
     41elif "$TSHELL" -c 'foo () { (exit 0); exit 0; }; foo' >/dev/null 2>&1
     42then
     43    :
     44else
     45    for cmd in sh bash ash bsh ksh zsh sh5; do
     46        X="$PATH:/bin:/usr/bin:/usr/afsws/bin:/usr/ucb:/usr/xpg4/bin";
     47        OLD_IFS=${IFS}
     48        IFS=':'; export IFS
     49        for dir in $X; do
     50            shell="$dir/$cmd"
     51            if (test -f "$shell" || test -f "$shell.exe")
     52            then
     53                if "$shell" -c  'foo () { (exit 0); exit 0; }; foo' >/dev/null 2>&1
     54                then
     55                    TSHELL="$shell"; export TSHELL
     56                    IFS=${OLD_IFS}; export IFS
     57                    exec "$shell" "$0" --re-executed ${1+"$@"}
     58                fi
     59            fi
     60        done
     61        IFS=${OLD_IFS}; export IFS
     62    done
     63    echo "-----------------------------------------------------------------"
     64    echo "ERROR: Unable to locate a shell interpreter with function support" >&2
     65    echo "-----------------------------------------------------------------"
     66    { (exit 1); exit 1; }
     67fi
     68
     69# -----------------------------------------------------------------------
     70# Make sure we support 'let' (from the autoconf manual)
     71# -----------------------------------------------------------------------
     72
     73TSHELL="${TSHELL-/bin/sh}"
     74if test x"$1" = "x--re-run"
     75then
     76    shift
     77elif "$TSHELL" -c 'a=5; let "a = a + 5"' >/dev/null 2>&1
     78then
     79    :
     80else
     81    for cmd in sh bash ash bsh ksh zsh sh5; do
     82        X="$PATH:/bin:/usr/bin:/usr/afsws/bin:/usr/ucb:/usr/xpg4/bin";
     83        OLD_IFS=${IFS}
     84        IFS=':'; export IFS
     85        for dir in $X; do
     86            shell="$dir/$cmd"
     87            if (test -f "$shell" || test -f "$shell.exe")
     88            then
     89                if "$shell" -c  'foo () { (exit 0); exit 0; }; foo' >/dev/null 2>&1
     90                then
     91                    if "$shell" -c  'a=5; let "a = a + 5"' >/dev/null 2>&1
     92                    then
     93                        TSHELL="$shell"; export TSHELL
     94                        IFS=${OLD_IFS}; export IFS
     95                        exec "$shell" "$0" --re-run ${1+"$@"}
     96                    fi
     97                fi
     98            fi
     99        done
     100        IFS=${OLD_IFS}; export IFS
     101    done
     102    echo "-----------------------------------------------------------------"
     103    echo "ERROR: Unable to locate a shell interpreter with support for 'let'" >&2
     104    echo "-----------------------------------------------------------------"
     105    { (exit 1); exit 1; }
     106fi
     107
     108
     109umask 0022
    21110
    22111isok=`test -t 1 2>&1 | wc -c`
     
    366455        tmp="localhost"
    367456    fi
    368     echo "$tmp"
     457    #
     458    # first one is hostname, others are aliases
     459    #
     460    tmp2=`cat /etc/hosts | egrep "^ *[0123456789].* $tmp" | awk '{ print $2 }'`
     461    if [ -z "$tmp2" ]; then
     462        echo "$tmp"
     463    else
     464        echo "$tmp2"
     465    fi
    369466}
    370467
  • trunk/test/testcompile.sh

    r29 r30  
    2020#
    2121
    22 MAXTEST=56; export MAXTEST
     22MAXTEST=57; export MAXTEST
     23
     24run_flawfinder ()
     25{
     26    flawfinder --minlevel=3 --quiet src/s*.c | \
     27        egrep '^No hits found.' >/dev/null 2>&1
     28    if [ $? -eq 0 ]; then
     29        [ -z "$quiet" ] &&     log_ok   $2 ${MAXTEST} "$TEST";
     30    else
     31        flawfinder --minlevel=3 --quiet src/s*.c >test_log 2>&1
     32        [ -z "$quiet" ] && log_fail $2 ${MAXTEST} "$TEST";
     33        return 1
     34    fi
     35}
    2336
    2437run_smatch ()
     
    133146
    134147        #
     148        # test flawfinder
     149        #
     150        TEST="${S}check w/flawfinder${E}"
     151        #
     152        #
     153        let "num = num + 1" >/dev/null
     154        FLAWFINDER=`find_path flawfinder`
     155        #
     156        if [ -z "$FLAWFINDER" ]; then
     157            log_skip $num $MAXTEST 'check w/flawfinder (not in PATH)'
     158        else
     159            run_flawfinder 0 $num || let "numfail = numfail + 1"  >/dev/null
     160        fi
     161        #
     162
     163        #
    135164        # test standalone compilation
    136165        #
  • trunk/test/testext.sh

    r27 r30  
    5858        if test x$? = x0; then
    5959            [ -z "$verbose" ] ||     log_msg_ok "configure...";
    60             $MAKE  > /dev/null
     60            $MAKE  >/dev/null 2>>test_log
    6161            if test x$? = x0; then
    6262                [ -z "$verbose" ] || log_msg_ok "make...";
  • trunk/test/testrun_1.sh

    r27 r30  
    8282    REPLACEMENT='FileCheckScheduleOne = 6 12 * * *'
    8383    ex $RCFILE <<EOF
    84 :%s/${ORIGINAL}/${REPLACEMENT}/g
    85 :wq
     84%s/${ORIGINAL}/${REPLACEMENT}/g
     85wq
    8686EOF
    8787}
     
    865865            return 1
    866866        fi
    867         tmp=`./samhain -j -L $LOGFILE | grep ERR | wc -l`
     867        #
     868        # wtmp may not be readable
     869        #
     870        tmp=`./samhain -j -L $LOGFILE | grep ERR | grep -v wtmp | wc -l`
    868871        if [ $tmp -ne 0 ]; then
    869             [ -z "$verbose" ] || log_msg_fail "update not successful(?)";
     872            [ -z "$verbose" ] || log_msg_fail "errors during check";
    870873            return 1
    871874        fi
     
    889892prep_testdata ()
    890893{
    891     if [ -d "${BASE}" ]; then
    892         chmod -R 0700 "${BASE}" || {
    893             [ -z "$quiet" ] &&   log_msg_fail "chmod -R 0700 ${BASE}";
    894             return 1;
    895         }
     894    if test -d "$BASE"; then
     895        if [ -d "${BASE}" ]; then
     896            chmod -R 0700 "${BASE}" || {
     897                [ -z "$quiet" ] &&   log_msg_fail "chmod -R 0700 ${BASE}";
     898                return 1;
     899            }
     900        fi
    896901    fi
    897902
     
    947952        if test x$? = x0; then
    948953                [ -z "$verbose" ] ||     log_msg_ok "configure...";
    949                 $MAKE  > /dev/null
     954                $MAKE  >/dev/null 2>>test_log
    950955                if test x$? = x0; then
    951956                    [ -z "$verbose" ] || log_msg_ok "make...";
  • trunk/test/testrun_1c.sh

    r27 r30  
    255255        if test x$? = x0; then
    256256                [ -z "$verbose" ] ||     log_msg_ok "configure...";
    257                 $MAKE  'DBGDEF=-DSH_SUIDTESTDIR=\"${BASE}\"' >/dev/null
     257                $MAKE  'DBGDEF=-DSH_SUIDTESTDIR=\"${BASE}\"' >/dev/null 2>&1
    258258                if test x$? = x0; then
    259259                    [ -z "$verbose" ] || log_msg_ok "make...";
  • trunk/test/testrun_2.sh

    r29 r30  
    138138        REPLACEMENT="UseSeparateLogs=yes"
    139139        ex $RCFILE <<EOF
    140 :%s/$ORIGINAL/$REPLACEMENT/g
    141 :wq
     140%s/$ORIGINAL/$REPLACEMENT/g
     141wq
    142142EOF
    143143# :%s is the "ex" substitution command.
     
    182182            CLIENTLOG="${LOGFILE}.${remhost}"
    183183        else
    184             CLIENTLOG=`ls -1 ${LOGFILE}.* 2>/dev/null | tail -n 1`
     184            tail -n 1 ${SCRIPTDIR}/test.sh >/dev/null 2>&1
     185            if [ $? -eq 0 ]; then
     186                CLIENTLOG=`ls -1 ${LOGFILE}.* 2>/dev/null | tail -n 1`
     187            else
     188                CLIENTLOG=`ls -1 ${LOGFILE}.* 2>/dev/null | tail -1`
     189            fi
    185190        fi
    186191
     
    235240        REPLACEMENT_4="SetClientTimeLimit=20"
    236241        ex $RCFILE <<EOF
    237 :%s/${ORIGINAL_1}/${REPLACEMENT_1}/g
    238 :%s/${ORIGINAL_2}/${REPLACEMENT_2}/g
    239 :%s/${ORIGINAL_3}/${REPLACEMENT_3}/g
    240 :%s/${ORIGINAL_4}/${REPLACEMENT_4}/g
    241 :wq
     242%s/${ORIGINAL_1}/${REPLACEMENT_1}/g
     243%s/${ORIGINAL_2}/${REPLACEMENT_2}/g
     244%s/${ORIGINAL_3}/${REPLACEMENT_3}/g
     245%s/${ORIGINAL_4}/${REPLACEMENT_4}/g
     246wq
    242247EOF
    243248# :%s is the "ex" substitution command.
     
    336341        REPLACEMENT_1="SetSocketAllowUid=$me"
    337342        ex $RCFILE <<EOF
    338 :%s/${ORIGINAL_1}/${REPLACEMENT_1}/g
    339 :wq
     343%s/${ORIGINAL_1}/${REPLACEMENT_1}/g
     344wq
    340345EOF
    341346
     
    435440
    436441        kill ${PROC_Y}
     442        sleep 2
     443        kill -9 ${PROC_Y} >/dev/null 2>&1
    437444
    438445        [ -z "$VALGRIND" ] || {
     
    633640        #
    634641        cp samhain samhain.build || return 1
    635         make clean >/dev/null || return 1
     642        $MAKE clean >/dev/null || return 1
    636643
    637644        ${TOP_SRCDIR}/configure --quiet  $TRUST --enable-debug --enable-network=server  --enable-xml-log --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=${RCFILE}2  --with-log-file=${LOGFILE}2 --with-pid-file=$PW_DIR/.samhain_lock2 --with-html-file=${HTML}2 --with-state-dir=$PW_DIR --enable-encrypt=2 --with-port=49778
     
    655662        #
    656663        cp yule yule.2 || return 1
    657         make clean >/dev/null || return 1
     664        $MAKE clean >/dev/null || return 1
    658665
    659666        ${TOP_SRCDIR}/configure --quiet  $TRUST --enable-debug --enable-network=server  --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-html-file=$HTML --with-state-dir=$PW_DIR --enable-encrypt=2
  • trunk/test/testrun_2a.sh

    r29 r30  
    2525SERVER_BUILDOPTS="--quiet  $TRUST  --enable-network=server --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=${SH_LOCALHOST}  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock"; export SERVER_BUILDOPTS
    2626
    27 CLIENT_BUILDOPTS="--quiet  $TRUST --enable-debug --enable-network=client --enable-srp --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$RCFILE --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=localhost  --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS
     27CLIENT_BUILDOPTS="--quiet  $TRUST --enable-debug --enable-network=client --enable-srp --prefix=$PW_DIR --with-tmp-dir=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$RCFILE --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=localhost  --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS
    2828
    2929do_test_1_a () {
     
    131131        #
    132132        cp samhain samhain.build || return 1
    133         make clean >/dev/null || return 1
     133        $MAKE clean >/dev/null || return 1
    134134
    135135        ${TOP_SRCDIR}/configure ${SERVER_BUILDOPTS}
  • trunk/test/testrun_2b.sh

    r29 r30  
    2626SERVER_BUILDOPTS="--quiet  $TRUST  --enable-network=server --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=${SH_LOCALHOST}  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock"; export SERVER_BUILDOPTS
    2727
    28 CLIENT_BUILDOPTS="--quiet  $TRUST --enable-micro-stealth=137 --enable-debug --enable-network=client --enable-srp --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER${RCFILE_C} --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=localhost  --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS
     28CLIENT_BUILDOPTS="--quiet  $TRUST --enable-micro-stealth=137 --enable-debug --enable-network=client --enable-srp --prefix=$PW_DIR --with-tmp-dir=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER${RCFILE_C} --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=localhost  --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS
    2929
    3030testrun2b_internal ()
     
    8080
    8181    cp samhain samhain.build || return 1
    82     make clean >/dev/null || return 1
     82    $MAKE clean >/dev/null || return 1
    8383   
    8484    ${TOP_SRCDIR}/configure ${SERVER_BUILDOPTS}
  • trunk/test/testrun_2c.sh

    r27 r30  
    2222SERVER_BUILDOPTS="--quiet  $TRUST --enable-xml-log --enable-debug --enable-network=server --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=${SH_LOCALHOST}  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-database=mysql"; export SERVER_BUILDOPTS
    2323
    24 CLIENT_BUILDOPTS="--quiet  $TRUST --prefix=$PW_DIR --localstatedir=$PW_DIR --enable-network=client --disable-mail --disable-external-scripts --enable-login-watch --enable-xml-log --enable-db-reload --with-logserver=localhost --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS
     24CLIENT_BUILDOPTS="--quiet  $TRUST --prefix=$PW_DIR --with-tmp-dir=$PW_DIR --localstatedir=$PW_DIR --enable-network=client --disable-mail --disable-external-scripts --enable-login-watch --enable-xml-log --enable-db-reload --with-logserver=localhost --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS
    2525
    2626check_mysql_log () {
     
    9292    REPLACEMENT="DatabaseSeverity=info"
    9393    ex $RCFILE <<EOF
    94 :%s/$ORIGINAL/$REPLACEMENT/g
    95 :wq
     94%s/$ORIGINAL/$REPLACEMENT/g
     95wq
    9696EOF
    9797    #
  • trunk/test/testrun_2d.sh

    r27 r30  
    2222SERVER_BUILDOPTS="--quiet  $TRUST --enable-xml-log --enable-debug --enable-network=server --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=${SH_LOCALHOST}  --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-database=postgresql"; export SERVER_BUILDOPTS
    2323
    24 CLIENT_BUILDOPTS="--quiet  $TRUST --prefix=$PW_DIR --localstatedir=$PW_DIR --enable-network=client --disable-mail --disable-external-scripts --enable-login-watch --enable-xml-log --enable-db-reload --with-logserver=localhost --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS
     24CLIENT_BUILDOPTS="--quiet  $TRUST --prefix=$PW_DIR --with-tmp-dir=$PW_DIR --localstatedir=$PW_DIR --enable-network=client --disable-mail --disable-external-scripts --enable-login-watch --enable-xml-log --enable-db-reload --with-logserver=localhost --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS
    2525
    2626check_psql_log () {
     
    9494    REPLACEMENT="DatabaseSeverity=info"
    9595    ex $RCFILE <<EOF
    96 :%s/$ORIGINAL/$REPLACEMENT/g
    97 :wq
     96%s/$ORIGINAL/$REPLACEMENT/g
     97wq
    9898EOF
    9999    #
  • trunk/test/testtimesrv.sh

    r27 r30  
    3030prep_testdata ()
    3131{
    32     chmod -R 0700 "${BASE}" || {
    33         [ -z "$quiet" ] &&   log_msg_fail "chmod -R 0700 ${BASE}";
    34         return 1;
    35     }
     32    if test -d "$BASE"; then
     33        chmod -R 0700 "${BASE}" || {
     34            [ -z "$quiet" ] &&   log_msg_fail "chmod -R 0700 ${BASE}";
     35            return 1;
     36        }
     37    fi
    3638
    3739    rm -rf "${BASE}" || {
     
    140142        # standalone compilation
    141143        #
    142         [ -z "$verbose" ] || { echo; echo "${S}Building standalone agent w/timeserver${E}"; echo; }
     144        [ -z "$verbose" ] || { echo; echo "${S}Building standalone agent${E}"; echo; }
    143145        #
    144146        if test -r "Makefile"; then
     
    150152        if test x$? = x0; then
    151153                [ -z "$verbose" ] ||     log_msg_ok "configure...";
    152                 $MAKE  > /dev/null
     154                $MAKE  > /dev/null 2>>test_log
    153155                if test x$? = x0; then
    154156                    [ -z "$verbose" ] || log_msg_ok "make...";
  • trunk/yulerc.template

    r1 r30  
    165165#####################################################
    166166
    167 [Misc]
    168 
    169 ## whether to become a daemon process
    170 ## (this is not honoured on database initialisation)
    171 #
    172 # Daemon = no
    173 Daemon = yes
    174 
    175 
    176167
    177168[Misc]
     
    183174# SetLoopTime = 60
    184175SetLoopTime = 600
     176
     177## Normally, client messages are regarded as data within a
     178## server message of fixed severity. The following two
     179## options cause the server to use the original severity/class
     180## of client messages for logging.
     181#
     182# UseClientSeverity = False
     183# UseClientClass    = False
    185184
    186185## The maximum time between client messages (seconds)
Note: See TracChangeset for help on using the changeset viewer.