Changeset 27 for trunk


Ignore:
Timestamp:
Apr 6, 2006, 8:55:51 PM (19 years ago)
Author:
rainer
Message:

Support for server-to-server relay and more user policies

Location:
trunk
Files:
53 edited

Legend:

Unmodified
Added
Removed
  • trunk/deploy.sh.in

    r1 r27  
    11#! /bin/sh
     2
     3#
     4# Copyright Rainer Wichmann (2005)
     5#
     6# License Information:
     7# This program is free software; you can redistribute it and/or modify
     8# it under the terms of the GNU General Public License as published by
     9# the Free Software Foundation; either version 2 of the License, or
     10# (at your option) any later version.
     11#
     12# This program is distributed in the hope that it will be useful,
     13# but WITHOUT ANY WARRANTY; without even the implied warranty of
     14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15# GNU General Public License for more details.
     16#
     17# You should have received a copy of the GNU General Public License
     18# along with this program; if not, write to the Free Software
     19# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     20#
    221
    322#VERSION2.0
  • trunk/docs/Changelog

    r25 r27  
    112.2.0:
     2        * add copyright/license info to test scripts
     3        * add copyright/license info to deployment system scripts
     4        * support server-to-server relay
     5        * new CL option --server-port
     6        * minor improvements in manual
    27        * patch by Yoann Vandoorselaere for sh_prelude.c
    38        * allow --longopt arg as well as --longopt=arg
  • trunk/docs/README.UPGRADE

    r18 r27  
     1
     2since 2.2.0: server-to-server relay is possible
     3
     4  -- this implies that problems will arise if your server is misconfigured
     5     to connect to itself (SetExportSeverity is explicitely set
     6     to a threshold different from 'none', and the logserver is set to
     7     localhost). The server may deadlock in this case.
     8
     9
     10
    111since 2.1.0: update and daemon mode can be combined
    212
  • trunk/dsys/comBUILD

    r1 r27  
    44#
    55#########################################################################
     6#
     7# Copyright Rainer Wichmann (2005)
     8#
     9# License Information:
     10# This program is free software; you can redistribute it and/or modify
     11# it under the terms of the GNU General Public License as published by
     12# the Free Software Foundation; either version 2 of the License, or
     13# (at your option) any later version.
     14#
     15# This program is distributed in the hope that it will be useful,
     16# but WITHOUT ANY WARRANTY; without even the implied warranty of
     17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     18# GNU General Public License for more details.
     19#
     20# You should have received a copy of the GNU General Public License
     21# along with this program; if not, write to the Free Software
     22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     23#
    624
    725commandBUILD() {
  • trunk/dsys/comCHECKSRC

    r1 r27  
    44#
    55#########################################################################
     6#
     7# Copyright Rainer Wichmann (2005)
     8#
     9# License Information:
     10# This program is free software; you can redistribute it and/or modify
     11# it under the terms of the GNU General Public License as published by
     12# the Free Software Foundation; either version 2 of the License, or
     13# (at your option) any later version.
     14#
     15# This program is distributed in the hope that it will be useful,
     16# but WITHOUT ANY WARRANTY; without even the implied warranty of
     17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     18# GNU General Public License for more details.
     19#
     20# You should have received a copy of the GNU General Public License
     21# along with this program; if not, write to the Free Software
     22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     23#
    624
    725commandCHECKSRC() {
  • trunk/dsys/comCLEAN

    r1 r27  
    44#
    55#########################################################################
     6#
     7# Copyright Rainer Wichmann (2005)
     8#
     9# License Information:
     10# This program is free software; you can redistribute it and/or modify
     11# it under the terms of the GNU General Public License as published by
     12# the Free Software Foundation; either version 2 of the License, or
     13# (at your option) any later version.
     14#
     15# This program is distributed in the hope that it will be useful,
     16# but WITHOUT ANY WARRANTY; without even the implied warranty of
     17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     18# GNU General Public License for more details.
     19#
     20# You should have received a copy of the GNU General Public License
     21# along with this program; if not, write to the Free Software
     22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     23#
    624
    725commandCLEAN() {
  • trunk/dsys/comDOWNLOAD

    r25 r27  
    44#
    55#########################################################################
     6#
     7# Copyright Rainer Wichmann (2005)
     8#
     9# License Information:
     10# This program is free software; you can redistribute it and/or modify
     11# it under the terms of the GNU General Public License as published by
     12# the Free Software Foundation; either version 2 of the License, or
     13# (at your option) any later version.
     14#
     15# This program is distributed in the hope that it will be useful,
     16# but WITHOUT ANY WARRANTY; without even the implied warranty of
     17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     18# GNU General Public License for more details.
     19#
     20# You should have received a copy of the GNU General Public License
     21# along with this program; if not, write to the Free Software
     22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     23#
    624
    725commandDOWNLOAD() {
  • trunk/dsys/comINSTALL

    r3 r27  
    44#
    55#########################################################################
     6#
     7# Copyright Rainer Wichmann (2005)
     8#
     9# License Information:
     10# This program is free software; you can redistribute it and/or modify
     11# it under the terms of the GNU General Public License as published by
     12# the Free Software Foundation; either version 2 of the License, or
     13# (at your option) any later version.
     14#
     15# This program is distributed in the hope that it will be useful,
     16# but WITHOUT ANY WARRANTY; without even the implied warranty of
     17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     18# GNU General Public License for more details.
     19#
     20# You should have received a copy of the GNU General Public License
     21# along with this program; if not, write to the Free Software
     22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     23#
    624
    725commandINSTALL() {
  • trunk/dsys/comUNINSTALL

    r1 r27  
    44#
    55#########################################################################
     6#
     7# Copyright Rainer Wichmann (2005)
     8#
     9# License Information:
     10# This program is free software; you can redistribute it and/or modify
     11# it under the terms of the GNU General Public License as published by
     12# the Free Software Foundation; either version 2 of the License, or
     13# (at your option) any later version.
     14#
     15# This program is distributed in the hope that it will be useful,
     16# but WITHOUT ANY WARRANTY; without even the implied warranty of
     17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     18# GNU General Public License for more details.
     19#
     20# You should have received a copy of the GNU General Public License
     21# along with this program; if not, write to the Free Software
     22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     23#
    624
    725commandUNINSTALL() {
  • trunk/dsys/funcBUILD

    r1 r27  
    44#
    55#########################################################################
     6#
     7# Copyright Rainer Wichmann (2005)
     8#
     9# License Information:
     10# This program is free software; you can redistribute it and/or modify
     11# it under the terms of the GNU General Public License as published by
     12# the Free Software Foundation; either version 2 of the License, or
     13# (at your option) any later version.
     14#
     15# This program is distributed in the hope that it will be useful,
     16# but WITHOUT ANY WARRANTY; without even the implied warranty of
     17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     18# GNU General Public License for more details.
     19#
     20# You should have received a copy of the GNU General Public License
     21# along with this program; if not, write to the Free Software
     22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     23#
    624
    725#------------------------------------------------------------------------
  • trunk/dsys/funcDB

    r1 r27  
    44#
    55#########################################################################
     6#
     7# Copyright Rainer Wichmann (2005)
     8#
     9# License Information:
     10# This program is free software; you can redistribute it and/or modify
     11# it under the terms of the GNU General Public License as published by
     12# the Free Software Foundation; either version 2 of the License, or
     13# (at your option) any later version.
     14#
     15# This program is distributed in the hope that it will be useful,
     16# but WITHOUT ANY WARRANTY; without even the implied warranty of
     17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     18# GNU General Public License for more details.
     19#
     20# You should have received a copy of the GNU General Public License
     21# along with this program; if not, write to the Free Software
     22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     23#
    624
    725DBFTEST=0
  • trunk/dsys/funcDIALOG

    r1 r27  
    44#
    55#########################################################################
     6#
     7# Copyright Rainer Wichmann (2005)
     8#
     9# License Information:
     10# This program is free software; you can redistribute it and/or modify
     11# it under the terms of the GNU General Public License as published by
     12# the Free Software Foundation; either version 2 of the License, or
     13# (at your option) any later version.
     14#
     15# This program is distributed in the hope that it will be useful,
     16# but WITHOUT ANY WARRANTY; without even the implied warranty of
     17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     18# GNU General Public License for more details.
     19#
     20# You should have received a copy of the GNU General Public License
     21# along with this program; if not, write to the Free Software
     22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     23#
    624
    725# print without newline
  • trunk/dsys/funcEXE

    r1 r27  
    44#
    55#########################################################################
     6#
     7# Copyright Rainer Wichmann (2005)
     8#
     9# License Information:
     10# This program is free software; you can redistribute it and/or modify
     11# it under the terms of the GNU General Public License as published by
     12# the Free Software Foundation; either version 2 of the License, or
     13# (at your option) any later version.
     14#
     15# This program is distributed in the hope that it will be useful,
     16# but WITHOUT ANY WARRANTY; without even the implied warranty of
     17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     18# GNU General Public License for more details.
     19#
     20# You should have received a copy of the GNU General Public License
     21# along with this program; if not, write to the Free Software
     22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     23#
    624
    725findEXE() {
  • trunk/dsys/funcINSTALL

    r4 r27  
    44#
    55#########################################################################
     6#
     7# Copyright Rainer Wichmann (2005)
     8#
     9# License Information:
     10# This program is free software; you can redistribute it and/or modify
     11# it under the terms of the GNU General Public License as published by
     12# the Free Software Foundation; either version 2 of the License, or
     13# (at your option) any later version.
     14#
     15# This program is distributed in the hope that it will be useful,
     16# but WITHOUT ANY WARRANTY; without even the implied warranty of
     17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     18# GNU General Public License for more details.
     19#
     20# You should have received a copy of the GNU General Public License
     21# along with this program; if not, write to the Free Software
     22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     23#
    624
    725getconfopts () {
  • trunk/dsys/funcPRINT

    r1 r27  
    44#
    55#########################################################################
     6#
     7# Copyright Rainer Wichmann (2005)
     8#
     9# License Information:
     10# This program is free software; you can redistribute it and/or modify
     11# it under the terms of the GNU General Public License as published by
     12# the Free Software Foundation; either version 2 of the License, or
     13# (at your option) any later version.
     14#
     15# This program is distributed in the hope that it will be useful,
     16# but WITHOUT ANY WARRANTY; without even the implied warranty of
     17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     18# GNU General Public License for more details.
     19#
     20# You should have received a copy of the GNU General Public License
     21# along with this program; if not, write to the Free Software
     22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     23#
    624
    725# Fatal error
  • trunk/dsys/funcSETUP

    r1 r27  
    44#
    55#########################################################################
     6#
     7# Copyright Rainer Wichmann (2005)
     8#
     9# License Information:
     10# This program is free software; you can redistribute it and/or modify
     11# it under the terms of the GNU General Public License as published by
     12# the Free Software Foundation; either version 2 of the License, or
     13# (at your option) any later version.
     14#
     15# This program is distributed in the hope that it will be useful,
     16# but WITHOUT ANY WARRANTY; without even the implied warranty of
     17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     18# GNU General Public License for more details.
     19#
     20# You should have received a copy of the GNU General Public License
     21# along with this program; if not, write to the Free Software
     22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     23#
    624
    725# test setup
  • trunk/dsys/initscript

    r1 r27  
    11#! /bin/sh
     2
     3#
     4# Copyright Rainer Wichmann (2005)
     5#
     6# License Information:
     7# This program is free software; you can redistribute it and/or modify
     8# it under the terms of the GNU General Public License as published by
     9# the Free Software Foundation; either version 2 of the License, or
     10# (at your option) any later version.
     11#
     12# This program is distributed in the hope that it will be useful,
     13# but WITHOUT ANY WARRANTY; without even the implied warranty of
     14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15# GNU General Public License for more details.
     16#
     17# You should have received a copy of the GNU General Public License
     18# along with this program; if not, write to the Free Software
     19# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     20#
    221
    322startup=no
  • trunk/dsys/postinstall

    r1 r27  
    11#! /bin/sh
     2
     3#
     4# Copyright Rainer Wichmann (2005)
     5#
     6# License Information:
     7# This program is free software; you can redistribute it and/or modify
     8# it under the terms of the GNU General Public License as published by
     9# the Free Software Foundation; either version 2 of the License, or
     10# (at your option) any later version.
     11#
     12# This program is distributed in the hope that it will be useful,
     13# but WITHOUT ANY WARRANTY; without even the implied warranty of
     14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15# GNU General Public License for more details.
     16#
     17# You should have received a copy of the GNU General Public License
     18# along with this program; if not, write to the Free Software
     19# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     20#
    221
    322name=`./samhain-install.sh --print-config name`
  • trunk/dsys/preinstall

    r1 r27  
    11#! /bin/sh
     2#
     3# Copyright Rainer Wichmann (2005)
     4#
     5# License Information:
     6# This program is free software; you can redistribute it and/or modify
     7# it under the terms of the GNU General Public License as published by
     8# the Free Software Foundation; either version 2 of the License, or
     9# (at your option) any later version.
     10#
     11# This program is distributed in the hope that it will be useful,
     12# but WITHOUT ANY WARRANTY; without even the implied warranty of
     13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14# GNU General Public License for more details.
     15#
     16# You should have received a copy of the GNU General Public License
     17# along with this program; if not, write to the Free Software
     18# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     19#
    220
    321name=`./samhain-install.sh --print-config name`
  • trunk/include/samhain.h

    r25 r27  
    138138  SH_LEVEL_USER0       = 7,
    139139  SH_LEVEL_USER1       = 8,
    140   SH_LEVEL_PRELINK     = 9
     140  SH_LEVEL_USER2       = 9,
     141  SH_LEVEL_USER3       = 10,
     142  SH_LEVEL_USER4       = 11,
     143  SH_LEVEL_PRELINK     = 12
    141144};
    142145
  • trunk/include/sh_error.h

    r22 r27  
    3030  SH_ERR_T_START  = 0,
    3131
    32   /* 1-9 = SH_LEVEL_XXX */
     32  /* 1-13 = SH_LEVEL_XXX */
    3333
    3434  SH_ERR_T_RO      = SH_LEVEL_READONLY,
     
    4040  SH_ERR_T_USER0   = SH_LEVEL_USER0, 
    4141  SH_ERR_T_USER1   = SH_LEVEL_USER1, 
     42  SH_ERR_T_USER2   = SH_LEVEL_USER2, 
     43  SH_ERR_T_USER3   = SH_LEVEL_USER3, 
     44  SH_ERR_T_USER4   = SH_LEVEL_USER4, 
    4245  SH_ERR_T_PRELINK = SH_LEVEL_PRELINK, 
    4346
    44   SH_ERR_T_DIR    = 10,
    45   SH_ERR_T_FILE   = 11,
    46   SH_ERR_T_NAME   = 12,
     47  SH_ERR_T_DIR    = 13,
     48  SH_ERR_T_FILE   = 14,
     49  SH_ERR_T_NAME   = 15,
    4750
    48   SH_ERR_T_END    = 13
     51  SH_ERR_T_END    = 16
    4952};
    5053
  • trunk/include/sh_files.h

    r22 r27  
    7373int  sh_files_pushdir_user1 (const char * dirName);
    7474
     75/* push a directory on the stack USER2
     76 */
     77int  sh_files_pushdir_user2 (const char * dirName);
     78
     79/* push a directory on the stack USER3
     80 */
     81int  sh_files_pushdir_user3 (const char * dirName);
     82
     83/* push a directory on the stack USER4
     84 */
     85int  sh_files_pushdir_user4 (const char * dirName);
     86
    7587/* push a directory on the stack PRELINK
    7688 */
     
    109121 */
    110122int  sh_files_pushfile_user1 (const char * dirName);
     123
     124/* push a file on the stack USER2
     125 */
     126int  sh_files_pushfile_user2 (const char * dirName);
     127
     128/* push a file on the stack USER3
     129 */
     130int  sh_files_pushfile_user3 (const char * dirName);
     131
     132/* push a file on the stack USER4
     133 */
     134int  sh_files_pushfile_user4 (const char * dirName);
    111135
    112136/* push a file on the stack PRELINK
     
    155179int sh_files_redef_user0(const char * str);
    156180int sh_files_redef_user1(const char * str);
     181int sh_files_redef_user2(const char * str);
     182int sh_files_redef_user3(const char * str);
     183int sh_files_redef_user4(const char * str);
    157184int sh_files_redef_prelink(const char * str);
    158185int sh_files_redef_readonly(const char * str);
  • trunk/include/sh_forward.h

    r22 r27  
    4141 */
    4242int sh_forward_make_client (const char * str);
     43
     44/* set port to which we connect
     45 */
     46int sh_forward_server_port (const char * str);
    4347
    4448#ifdef SH_WITH_SERVER
     
    9195#endif
    9296
    93 #ifdef SH_WITH_CLIENT
     97#if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER)
    9498/* talk to server
    9599 */
    96100long  sh_forward (char * errmsg);
    97101
     102/* set log server
     103 */
     104int sh_forward_setlogserver (const char * address);
     105void reset_count_dev_server(void);
     106#endif
     107
     108#ifdef SH_WITH_CLIENT
    98109
    99110/* request file from server. file may be "CONF" or "DATA".
     
    101112long sh_forward_req_file (char * file);
    102113
    103 /* set log server
    104  */
    105 int sh_forward_setlogserver (const char * address);
    106 void reset_count_dev_server(void);
    107 
    108114#endif
    109115
  • trunk/include/sh_tools.h

    r1 r27  
    5353
    5454
    55 #if defined (SH_WITH_CLIENT)
     55#if defined (SH_WITH_CLIENT) || defined(SH_WITH_SERVER)
    5656
    5757unsigned long write_port (int sockfd, char *buf, unsigned long nbytes,
     
    6565                 unsigned long * length, char * u);
    6666
    67 
    68 SL_TICKET open_tmp (void);
    69 int close_tmp (SL_TICKET fd);
    70 int rewind_tmp (SL_TICKET fd);
     67/*
     68  SL_TICKET open_tmp (void);
     69  int close_tmp (SL_TICKET fd);
     70  int rewind_tmp (SL_TICKET fd);
     71*/
    7172
    7273void sh_tools_server_cmd(const char * srvcmd);
     
    7879#endif
    7980
     81#if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER) || defined(SH_STEALTH) || defined(WITH_GPG) || defined(WITH_PGP)
     82SL_TICKET open_tmp (void);
     83int close_tmp (SL_TICKET fd);
     84int rewind_tmp (SL_TICKET fd);
     85#endif
    8086
    8187#endif
  • trunk/include/sh_unix.h

    r25 r27  
    9999extern  unsigned long mask_USER0;
    100100extern  unsigned long mask_USER1;
     101extern  unsigned long mask_USER2;
     102extern  unsigned long mask_USER3;
     103extern  unsigned long mask_USER4;
    101104/* like READONLY, but without MTM,CTM,SIZ,INO, abd with PREL)
    102105 */
  • trunk/man/samhain.8

    r3 r27  
    4848.SS "MISCELLANEOUS"
    4949.PP
     50
     51.B samhain
     52.RI \-\-server\-port= portnumber
    5053
    5154.B samhain
     
    300303.SS "MISCELLANEOUS OPTIONS"
    301304.PP
     305
     306.B samhain
     307.RI \-\-server\-port= portnumber
     308
     309Choose the port on the server host to which the client will connect.
    302310
    303311.B samhain
  • trunk/man/samhainrc.5

    r1 r27  
    9696.TP
    9797.I "[User1]"
     98.TP
     99.I "[User2]"
     100.TP
     101.I "[User3]"
     102.TP
     103.I "[User4]"
    98104These are reserved for user-defined policies.
    99105.TP
     
    172178.br
    173179.BI  SeverityUser0= val,
     180.br
     181.BI  SeverityUser1= val,
     182.br
     183.BI  SeverityUser2= val,
     184.br
     185.BI  SeverityUser3= val,
    174186and
    175187.br
    176 .BI  SeverityUser1= val
     188.BI  SeverityUser4= val
    177189define the error levels for failures to verify the integrity of
    178190files/directories of the respective types. I.e. if such a file shows
     
    514526sets the hostname for the log server.
    515527.br
     528.BI SetServerPort= portnumber
     529sets the port on the server to connect to.
     530.br
    516531.BI SetDatabasePath= AUTO|/path
    517532Path to database (AUTO to tack hostname on compiled-in path).
     
    547562.BI RedefUser1= +/-XXX,+/-YYY,...
    548563Add or subtract tests XXX from the User1 policy.
     564.br
     565.BI RedefUser2= +/-XXX,+/-YYY,...
     566Add or subtract tests XXX from the User2 policy.
     567.br
     568.BI RedefUser3= +/-XXX,+/-YYY,...
     569Add or subtract tests XXX from the User3 policy.
     570.br
     571.BI RedefUser4= +/-XXX,+/-YYY,...
     572Add or subtract tests XXX from the User4 policy.
    549573.TP
    550574.B Server Only
  • trunk/src/sh_database.c

    r22 r27  
    11921192        }
    11931193    }
    1194 #if 0
    1195   /* apparently slower, see gyule.7 */
    1196   len = (long) strlen(val);
    1197 
    1198   if ((val[0] != '\0') && (*size > 2))
    1199     {
    1200       if (flag == 1)
    1201         {
    1202           *end = ',';  ++end;
    1203           *end = '\''; ++end; (*size) -= 2;
    1204           *end = '\0';
    1205        
    1206           if ((long) *size > (len+2))
    1207             {
    1208               (void) sl_strlcat(end, val, (size_t) *size);
    1209               end   += len; (*size) -= len;
    1210               *end = '\''; ++end;  (*size) -= 1;
    1211             }
    1212           *end = '\0';
    1213         }
    1214       else
    1215         {
    1216           *end = ',';  ++end; (*size) -= 1;
    1217           *end = '\0';
    1218        
    1219           if ((long) *size > (len+1))
    1220             {
    1221               (void) sl_strlcat(end, val, (size_t) *size);
    1222               end   += len; (*size) -= len;
    1223             }
    1224           *end = '\0';
    1225         }
    1226     }
    1227 #endif
     1194
    12281195  return end;
    12291196}
     
    16951662}
    16961663
     1664/* recursively enter linked list of messages into database, last first
     1665 */
     1666int sh_database_insert_rec (dbins * curr, unsigned int depth)
     1667{
     1668  long    id = 0;
     1669  dbins * prev;
     1670
     1671  SL_ENTER(_("sh_database_insert_rec"));
     1672
     1673  if (curr->next)
     1674    {
     1675      prev = curr->next;
     1676      sl_strlcpy(prev->host, curr->host, 64);
     1677      id = sh_database_insert_rec (curr->next, (depth + 1));
     1678    }
     1679
     1680  if (id != 0)                       /* this is a server wrapper          */
     1681    {
     1682      if (enter_wrapper != 0)
     1683        {
     1684          id = sh_database_entry (curr, id);
     1685        }
     1686    }
     1687  else
     1688    {
     1689      /*
     1690       * id = -1 is the client message; log_ref will be NULL
     1691       */
     1692      if (depth > 0)                  /* this is a client message         */
     1693        id = sh_database_entry (curr, -1);
     1694      else                            /* this is a generic server message */
     1695        id = sh_database_entry (curr, 0);
     1696    }
     1697
     1698  SH_FREE(curr);
     1699
     1700  SL_RETURN(id, _("sh_database_insert"));
     1701}
     1702
    16971703int sh_database_insert (char * message)
    16981704{
    16991705  dbins * db_entry;
    1700   dbins * prev;
    1701   dbins * curr;
    1702   long    id = 0;
    1703 #ifdef HOST_SWITCH
    1704   char  * temp[64];
    1705 #endif
    17061706
    17071707  SL_ENTER(_("sh_database_insert"));
     
    17141714  (void) sh_database_parse (message, db_entry);
    17151715
    1716   /* Enter the list into the database. Actually, the list can only have
    1717    * two entries at most.
    1718    */
    1719   curr = db_entry;
    1720   if (curr->next)
    1721     {
    1722       prev = curr->next;
    1723 #ifdef HOST_SWITCH
    1724       strncpy(temp, prev->host,       64);
     1716  /* recursively enter the linked list into the database
     1717   */
     1718  (void) sh_database_insert_rec (db_entry, 0);
     1719
     1720  SL_RETURN(0, _("sh_database_insert"));
     1721}
     1722
    17251723#endif
    1726       strncpy(prev->host, curr->host, 64);
    1727 #ifdef HOST_SWITCH
    1728       strncpy(curr->host, temp,       64);
    1729 #endif
    1730       id = sh_database_entry (prev, -1);
    1731       SH_FREE(prev);
    1732     }
    1733 
    1734   if (id != 0)                       /* this is a server wrapper          */
    1735     {
    1736       if (enter_wrapper != 0)
    1737         (void) sh_database_entry (curr, id);
    1738     }
    1739   else                                /* this is a generic server message */
    1740     {
    1741       (void) sh_database_entry (curr, 0);
    1742     }
    1743   SH_FREE(curr);
    1744 
    1745   SL_RETURN(0, _("sh_database_insert"));
    1746 }
    1747 
    1748 #endif
  • trunk/src/sh_error.c

    r22 r27  
    639639}
    640640
    641 #ifdef SH_WITH_CLIENT
     641#if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER)
    642642/* set severity for TCP export
    643643 */
     
    843843#endif
    844844
    845 #ifdef SH_WITH_CLIENT
     845#if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER)
    846846  char   * ex_msg;
    847847#endif
     
    862862  static int syslog_block = 0;
    863863  static int log_block    = 0;
    864 #if defined(SH_WITH_CLIENT)
     864#if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER)
    865865  static int export_block = 0;
    866866#endif
     
    926926    severity = sev;
    927927
     928  /* these are messages from remote sources
     929   */
    928930  if ((severity  & SH_ERR_INET) != 0)
    929931    {
     
    939941       ( (errFlags.sysloglevel  & severity    ) == 0 ||
    940942         (errFlags.syslog_class & (1 << class)) == 0 )     &&
    941 #ifdef SH_WITH_CLIENT
     943#if defined(SH_WITH_CLIENT) || defined(SH_WITH_CLIENT)
    942944       ( (errFlags.exportlevel  & severity    ) == 0 ||
    943945         (errFlags.export_class & (1 << class)) == 0 )     &&
     
    958960         (errFlags.mail_class    & (1 << class)) == 0 )
    959961#ifdef SH_WITH_SERVER
    960       && (flag_inet == S_FALSE)
     962       && (flag_inet == S_FALSE) /* still log messages from remote sources */
    961963#endif
    962964       )
     
    11191121       * to log server
    11201122       ****************************************************/
    1121 #ifdef SH_WITH_CLIENT
     1123#if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER)
    11221124      /* Export by TCP.
    11231125       */
    1124       if ((errFlags.exportlevel  & severity  )   != 0 &&
    1125           (errFlags.export_class & (1 << class)) != 0 &&
    1126           (errFlags.exportlevel  & SH_ERR_NOT)   == 0 &&
    1127           class != AUD                                &&
    1128           sh.flag.isserver != GOOD                    &&
    1129           (flag_inet == S_FALSE) ) /* don't log inet to export */
     1126
     1127      if ( ((errFlags.exportlevel  & severity  )   != 0 &&
     1128            (errFlags.export_class & (1 << class)) != 0 &&
     1129            (errFlags.exportlevel  & SH_ERR_NOT)   == 0 &&
     1130            class != AUD                               )
     1131#ifdef SH_WITH_SERVER
     1132           || (flag_inet == S_TRUE) /* always log inet to export */
     1133#endif
     1134          /* sh.flag.isserver != GOOD                    && */
     1135          /* (flag_inet == S_FALSE) */ /* don't log inet to export */
     1136           )
    11301137        {
    11311138          if (export_block == 0)
     
    11421149              sl_snprintf(ex_msg, ex_len, _("%d?%u?%s"),
    11431150                      severity, class, lmsg->msg);
    1144 
    11451151              retval = sh_forward (ex_msg);
    11461152              SH_FREE(ex_msg);
  • trunk/src/sh_files.c

    r22 r27  
    454454}
    455455
    456 
    457456int sh_files_pushfile_user1 (const char * str_s)
    458457{
    459458  return (sh_files_pushfile (SH_LEVEL_USER1, str_s));
     459}
     460
     461int sh_files_pushfile_user2 (const char * str_s)
     462{
     463  return (sh_files_pushfile (SH_LEVEL_USER2, str_s));
     464}
     465
     466int sh_files_pushfile_user3 (const char * str_s)
     467{
     468  return (sh_files_pushfile (SH_LEVEL_USER3, str_s));
     469}
     470
     471int sh_files_pushfile_user4 (const char * str_s)
     472{
     473  return (sh_files_pushfile (SH_LEVEL_USER4, str_s));
    460474}
    461475
     
    612626  return (sh_files_parse_mask(&mask_USER1, str));
    613627}
     628int sh_files_redef_user2(const char * str)
     629{
     630  return (sh_files_parse_mask(&mask_USER2, str));
     631}
     632int sh_files_redef_user3(const char * str)
     633{
     634  return (sh_files_parse_mask(&mask_USER3, str));
     635}
     636int sh_files_redef_user4(const char * str)
     637{
     638  return (sh_files_parse_mask(&mask_USER4, str));
     639}
    614640int sh_files_redef_readonly(const char * str)
    615641{
     
    657683    case SH_LEVEL_USER1:
    658684      return (unsigned long) mask_USER1;
     685    case SH_LEVEL_USER2:
     686      return (unsigned long) mask_USER2;
     687    case SH_LEVEL_USER3:
     688      return (unsigned long) mask_USER3;
     689    case SH_LEVEL_USER4:
     690      return (unsigned long) mask_USER4;
    659691    case SH_LEVEL_PRELINK:
    660692      return (unsigned long) mask_PRELINK;
     
    10421074{
    10431075  return (sh_files_pushdir (SH_LEVEL_USER1, str_s));
     1076}
     1077
     1078int sh_files_pushdir_user2 (const char * str_s)
     1079{
     1080  return (sh_files_pushdir (SH_LEVEL_USER2, str_s));
     1081}
     1082
     1083int sh_files_pushdir_user3 (const char * str_s)
     1084{
     1085  return (sh_files_pushdir (SH_LEVEL_USER3, str_s));
     1086}
     1087
     1088int sh_files_pushdir_user4 (const char * str_s)
     1089{
     1090  return (sh_files_pushdir (SH_LEVEL_USER4, str_s));
    10441091}
    10451092
  • trunk/src/sh_forward.c

    r22 r27  
    335335#endif
    336336
    337 #ifdef SH_WITH_CLIENT
     337#if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER)
    338338
    339339static int count_dev_server = 0;
     
    708708static long sh_forward_try (char * errmsg);
    709709
     710static unsigned int ServerPort = SH_DEFAULT_PORT;
     711
     712int sh_forward_server_port (const char * str)
     713{
     714  unsigned long l;
     715  char * endptr;
     716
     717  SL_ENTER(_("sh_forward_server_port"));
     718
     719  l = strtoul (str, &endptr, 0);
     720  if (l > 65535 || endptr == str)
     721    {
     722      SL_RETURN (-1, _("sh_forward_server_port"));
     723    }
     724  ServerPort = (unsigned int) l;
     725  SL_RETURN (0, _("sh_forward_server_port"));
     726}
    710727
    711728long sh_forward (char * errmsg)
     
    880897
    881898  sockfd = connect_port_2 (sh.srvexport.name, sh.srvexport.alt,
    882                            SH_DEFAULT_PORT,
     899                           ServerPort,
    883900                           error_call, &error_num, error_msg, 256);
    884901
     
    14411458                                                flag_err,
    14421459                                                MSG_TCP_NOCONF);
    1443                               } else {
     1460                              }
     1461#ifdef SH_WITH_CLIENT
     1462                              else {
    14441463                                sh_socket_server_cmd(buffer);
    14451464                              }
     1465#endif
    14461466                              flag_err = 0;
    14471467
  • trunk/src/sh_getopt.c

    r22 r27  
    8080    sh_util_set_interactive },
    8181#endif
     82#if defined(SH_WITH_SERVER) || defined(SH_WITH_CLIENT)
     83  { N_("server-port"), 
     84    '-',
     85    N_("Set the server port to connect to"), 
     86    HAS_ARG_YES,
     87    sh_forward_server_port },
     88#endif
    8289#ifdef SH_WITH_SERVER
    8390  { N_("server"), 
     
    112119    HAS_ARG_YES,
    113120    sh_calls_set_bind_addr },
    114 #ifdef SH_WITH_CLIENT
     121#if defined(SH_WITH_SERVER) || defined(SH_WITH_CLIENT)
    115122  { N_("set-export-severity"), 
    116123    'e',
     
    554561          for (i = 0; op_table[i].longopt != NULL; ++i)
    555562            {
    556      
     563
    557564              if (sl_strncmp(_(op_table[i].longopt),
    558565                             &argv[1][2],
     
    562569                  if ( op_table[i].hasArg == HAS_ARG_YES )
    563570                    {
    564                       if ( (theequal = strchr(argv[1], '=')) == NULL)
     571                      theequal = strchr(argv[1], '=');
     572                      if (theequal == NULL)
    565573                        {
    566574                          if (argc < 3)
  • trunk/src/sh_hash.c

    r22 r27  
    297297    N_("[User0]"),
    298298    N_("[User1]"),
     299    N_("[User2]"),
     300    N_("[User3]"),
     301    N_("[User4]"),
    299302    N_("[Prelink]"),
    300303    NULL
  • trunk/src/sh_readconf.c

    r22 r27  
    6969  SH_SECTION_USER0,
    7070  SH_SECTION_USER1,
     71  SH_SECTION_USER2,
     72  SH_SECTION_USER3,
     73  SH_SECTION_USER4,
    7174  SH_SECTION_PRELINK,
    7275#if defined (SH_WITH_MAIL)
     
    108111  { N_("[User0]"),            SH_SECTION_USER0},
    109112  { N_("[User1]"),            SH_SECTION_USER1},
     113  { N_("[User2]"),            SH_SECTION_USER2},
     114  { N_("[User3]"),            SH_SECTION_USER3},
     115  { N_("[User4]"),            SH_SECTION_USER4},
    110116  { N_("[Prelink]"),          SH_SECTION_PRELINK},
    111117#ifdef WITH_EXTERNAL
     
    820826  { N_("file"),           SH_SECTION_USER1,      SH_SECTION_NONE,
    821827    sh_files_pushfile_user1 },
     828  { N_("dir"),            SH_SECTION_USER2,      SH_SECTION_NONE,
     829    sh_files_pushdir_user2 },
     830  { N_("file"),           SH_SECTION_USER2,      SH_SECTION_NONE,
     831    sh_files_pushfile_user2 },
     832  { N_("dir"),            SH_SECTION_USER3,      SH_SECTION_NONE,
     833    sh_files_pushdir_user3 },
     834  { N_("file"),           SH_SECTION_USER3,      SH_SECTION_NONE,
     835    sh_files_pushfile_user3 },
     836  { N_("dir"),            SH_SECTION_USER4,      SH_SECTION_NONE,
     837    sh_files_pushdir_user4 },
     838  { N_("file"),           SH_SECTION_USER4,      SH_SECTION_NONE,
     839    sh_files_pushfile_user4 },
    822840  { N_("dir"),            SH_SECTION_PRELINK,    SH_SECTION_NONE,
    823841    sh_files_pushdir_prelink },
     
    892910  { N_("redefuser1"),           SH_SECTION_MISC,   SH_SECTION_NONE,
    893911    sh_files_redef_user1 },
     912
     913  { N_("redefuser2"),           SH_SECTION_MISC,   SH_SECTION_NONE,
     914    sh_files_redef_user2 },
     915
     916  { N_("redefuser3"),           SH_SECTION_MISC,   SH_SECTION_NONE,
     917    sh_files_redef_user3 },
     918
     919  { N_("redefuser4"),           SH_SECTION_MISC,   SH_SECTION_NONE,
     920    sh_files_redef_user4 },
    894921
    895922  { N_("redefprelink"),         SH_SECTION_MISC,   SH_SECTION_NONE,
     
    941968#endif
    942969
    943 #ifdef SH_WITH_CLIENT
     970#if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER)
    944971  { N_("exportseverity"),      SH_SECTION_LOG,  SH_SECTION_NONE,
    945972    sh_error_setexport },
    946973  { N_("exportclass"),         SH_SECTION_LOG,  SH_SECTION_NONE,
    947974    sh_error_export_mask },
     975#if defined(SH_WITH_SERVER)
     976  { N_("setlogserver"),        SH_SECTION_SRV,  SH_SECTION_MISC,
     977    sh_forward_setlogserver },
     978#else
    948979  { N_("setlogserver"),        SH_SECTION_CLT,  SH_SECTION_MISC,
    949980    sh_forward_setlogserver },
     981#endif
    950982#endif
    951983  { N_("setfilechecktime"),  SH_SECTION_MISC,   SH_SECTION_NONE,
     
    10881120    N_("severityuser0"),
    10891121    N_("severityuser1"),
     1122    N_("severityuser2"),
     1123    N_("severityuser3"),
     1124    N_("severityuser4"),
    10901125    N_("severityprelink"),
    10911126    NULL
     
    11041139    SH_ERR_T_USER0,       
    11051140    SH_ERR_T_USER1,       
     1141    SH_ERR_T_USER2,       
     1142    SH_ERR_T_USER3,       
     1143    SH_ERR_T_USER4,       
    11061144    SH_ERR_T_PRELINK,       
    11071145  };
  • trunk/src/sh_srp.c

    r22 r27  
    384384}
    385385
    386 #ifdef SH_WITH_CLIENT
     386#if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER)
    387387 
    388388
     
    489489 
    490490 
    491 #ifdef SH_WITH_CLIENT
     491#if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER)
    492492 
    493493char * sh_srp_S_c (char * u_str, char * B_str)
  • trunk/src/sh_tools.c

    r22 r27  
    695695}
    696696
    697 #if defined(HAVE_NTIME) || defined(SH_WITH_CLIENT)
     697#if defined(HAVE_NTIME) || defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER)
    698698static
    699699int sh_write_select(int type, int sockfd,
     
    842842#endif
    843843
    844 #if defined (SH_WITH_CLIENT)
     844#if defined (SH_WITH_CLIENT) || defined(SH_WITH_SERVER)
    845845unsigned long write_port (int sockfd, char *buf, unsigned long nbytes,
    846846                          int * w_error, int timeout)
     
    862862#endif
    863863
    864 #if defined(HAVE_NTIME) || defined(SH_WITH_CLIENT)
     864#if defined(HAVE_NTIME) || defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER)
    865865
    866866unsigned long read_port (int sockfd, char *buf, unsigned long nbytes,
     
    898898#endif
    899899
    900 #if defined (SH_WITH_CLIENT)
     900#if defined (SH_WITH_CLIENT) || defined(SH_WITH_SERVER)
    901901
    902902int check_request (char * have, char * need)
     
    952952#endif
    953953
    954 #if defined (SH_WITH_CLIENT)
     954#if defined (SH_WITH_CLIENT) || defined (SH_WITH_SERVER)
    955955
    956956void get_header (unsigned char * head, unsigned long * bytes, char * u)
     
    10321032 * (msg_size = payload_size - key_len = payload_size - 48)
    10331033 */
     1034
     1035/*
     1036 * only SH_V2_FULLSIZE is used, and only once
     1037 */
     1038#if 0
    10341039#ifdef SH_WITH_SERVER
    10351040#define SH_V2_FULLSIZE  240
     
    10411046#define SH_V2_MESSAGE   960
    10421047#endif
     1048#endif
     1049#define SH_V2_FULLSIZE 1024
    10431050
    10441051#ifdef SH_ENCRYPT
     
    13831390#endif
    13841391
    1385 #if defined (SH_WITH_CLIENT)
     1392#if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER)
    13861393
    13871394/* verify the checksum of a buffer; checksum comes first
     
    15351542#endif
    15361543
    1537 #if defined(SH_WITH_CLIENT) || defined(SH_STEALTH) || defined(WITH_GPG) || defined(WITH_PGP)
     1544#if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER) || defined(SH_STEALTH) || defined(WITH_GPG) || defined(WITH_PGP)
    15381545
    15391546/* --------- secure temporary file ------------ */
  • trunk/src/sh_unix.c

    r25 r27  
    127127unsigned long mask_USER0        = MASK_USER_;
    128128unsigned long mask_USER1        = MASK_USER_;
     129unsigned long mask_USER2        = MASK_USER_;
     130unsigned long mask_USER3        = MASK_USER_;
     131unsigned long mask_USER4        = MASK_USER_;
    129132unsigned long mask_ALLIGNORE    = MASK_ALLIGNORE_;
    130133unsigned long mask_ATTRIBUTES   = MASK_ATTRIBUTES_;
     
    142145  mask_USER0        = MASK_USER_;
    143146  mask_USER1        = MASK_USER_;
     147  mask_USER2        = MASK_USER_;
     148  mask_USER3        = MASK_USER_;
     149  mask_USER4        = MASK_USER_;
    144150  mask_ALLIGNORE    = MASK_ALLIGNORE_;
    145151  mask_ATTRIBUTES   = MASK_ATTRIBUTES_;
  • trunk/src/sh_userfiles.c

    r1 r27  
    221221    else if ( strstr(s, "user0")     != NULL ) new->level = SH_LEVEL_USER0;
    222222    else if ( strstr(s, "user1")     != NULL ) new->level = SH_LEVEL_USER1;
     223    else if ( strstr(s, "user2")     != NULL ) new->level = SH_LEVEL_USER2;
     224    else if ( strstr(s, "user3")     != NULL ) new->level = SH_LEVEL_USER3;
     225    else if ( strstr(s, "user4")     != NULL ) new->level = SH_LEVEL_USER4;
    223226    else if ( strstr(s, "prelink")   != NULL ) new->level = SH_LEVEL_PRELINK;
    224227    else            /* The default */          new->level = default_level;
     
    332335                    (void) sh_files_pushfile_user1(filepath);
    333336                    break;
     337                case SH_LEVEL_USER2:
     338                    (void) sh_files_pushfile_user2(filepath);
     339                    break;
     340                case SH_LEVEL_USER3:
     341                    (void) sh_files_pushfile_user3(filepath);
     342                    break;
     343                case SH_LEVEL_USER4:
     344                    (void) sh_files_pushfile_user4(filepath);
     345                    break;
    334346                case SH_LEVEL_PRELINK:
    335347                    (void) sh_files_pushfile_prelink(filepath);
  • trunk/test/test.sh

    r22 r27  
    11#! /bin/sh
     2
     3#
     4# Copyright Rainer Wichmann (2006)
     5#
     6# License Information:
     7# This program is free software; you can redistribute it and/or modify
     8# it under the terms of the GNU General Public License as published by
     9# the Free Software Foundation; either version 2 of the License, or
     10# (at your option) any later version.
     11#
     12# This program is distributed in the hope that it will be useful,
     13# but WITHOUT ANY WARRANTY; without even the implied warranty of
     14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15# GNU General Public License for more details.
     16#
     17# You should have received a copy of the GNU General Public License
     18# along with this program; if not, write to the Free Software
     19# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     20#
    221
    322isok=`test -t 1 2>&1 | wc -c`
     
    288307    rm -f testrc_1.dyn
    289308    rm -f testrc_2
     309    rm -f testrc_22
    290310    rm -f ./.samhain_file
    291311    rm -f ./.samhain_log*
    292     rm -f ./.samhain_lock
     312    rm -f ./.samhain_lock*
    293313    test -d testrun_testdata && chmod -R 0700 testrun_testdata
    294314    test -d .quarantine && rm -rf .quarantine
     
    296316    rm -f test_log_db
    297317    rm -f test_log_prelude
    298     rm -f test_log_valgrind
     318    rm -f test_log_valgrind*
    299319    rm -f test_log_yulectl
    300320    rm -f yule.html
     321    rm -f yule.html2
    301322}
    302323
  • trunk/test/testcompile.sh

    r22 r27  
    11#! /bin/sh
     2
     3#
     4# Copyright Rainer Wichmann (2006)
     5#
     6# License Information:
     7# This program is free software; you can redistribute it and/or modify
     8# it under the terms of the GNU General Public License as published by
     9# the Free Software Foundation; either version 2 of the License, or
     10# (at your option) any later version.
     11#
     12# This program is distributed in the hope that it will be useful,
     13# but WITHOUT ANY WARRANTY; without even the implied warranty of
     14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15# GNU General Public License for more details.
     16#
     17# You should have received a copy of the GNU General Public License
     18# along with this program; if not, write to the Free Software
     19# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     20#
    221
    322MAXTEST=56; export MAXTEST
  • trunk/test/testext.sh

    r22 r27  
    11#! /bin/sh
     2
     3#
     4# Copyright Rainer Wichmann (2006)
     5#
     6# License Information:
     7# This program is free software; you can redistribute it and/or modify
     8# it under the terms of the GNU General Public License as published by
     9# the Free Software Foundation; either version 2 of the License, or
     10# (at your option) any later version.
     11#
     12# This program is distributed in the hope that it will be useful,
     13# but WITHOUT ANY WARRANTY; without even the implied warranty of
     14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15# GNU General Public License for more details.
     16#
     17# You should have received a copy of the GNU General Public License
     18# along with this program; if not, write to the Free Software
     19# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     20#
    221
    322MAXTEST=1; export MAXTEST
  • trunk/test/testhash.sh

    r19 r27  
    11#! /bin/sh
     2
     3#
     4# Copyright Rainer Wichmann (2006)
     5#
     6# License Information:
     7# This program is free software; you can redistribute it and/or modify
     8# it under the terms of the GNU General Public License as published by
     9# the Free Software Foundation; either version 2 of the License, or
     10# (at your option) any later version.
     11#
     12# This program is distributed in the hope that it will be useful,
     13# but WITHOUT ANY WARRANTY; without even the implied warranty of
     14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15# GNU General Public License for more details.
     16#
     17# You should have received a copy of the GNU General Public License
     18# along with this program; if not, write to the Free Software
     19# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     20#
    221
    322RCFILE="$PW_DIR/testrc_1.dyn";  export RCFILE
  • trunk/test/testrun_1.sh

    r25 r27  
    11#! /bin/sh
     2
     3#
     4# Copyright Rainer Wichmann (2006)
     5#
     6# License Information:
     7# This program is free software; you can redistribute it and/or modify
     8# it under the terms of the GNU General Public License as published by
     9# the Free Software Foundation; either version 2 of the License, or
     10# (at your option) any later version.
     11#
     12# This program is distributed in the hope that it will be useful,
     13# but WITHOUT ANY WARRANTY; without even the implied warranty of
     14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15# GNU General Public License for more details.
     16#
     17# You should have received a copy of the GNU General Public License
     18# along with this program; if not, write to the Free Software
     19# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     20#
    221
    322RCFILE="$PW_DIR/testrc_1.dyn";  export RCFILE
  • trunk/test/testrun_1a.sh

    r19 r27  
    11#! /bin/sh
     2
     3#
     4# Copyright Rainer Wichmann (2006)
     5#
     6# License Information:
     7# This program is free software; you can redistribute it and/or modify
     8# it under the terms of the GNU General Public License as published by
     9# the Free Software Foundation; either version 2 of the License, or
     10# (at your option) any later version.
     11#
     12# This program is distributed in the hope that it will be useful,
     13# but WITHOUT ANY WARRANTY; without even the implied warranty of
     14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15# GNU General Public License for more details.
     16#
     17# You should have received a copy of the GNU General Public License
     18# along with this program; if not, write to the Free Software
     19# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     20#
    221
    322BUILDOPTS="--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"
  • trunk/test/testrun_1b.sh

    r22 r27  
    11#! /bin/sh
    22
     3#
     4# Copyright Rainer Wichmann (2006)
     5#
     6# License Information:
     7# This program is free software; you can redistribute it and/or modify
     8# it under the terms of the GNU General Public License as published by
     9# the Free Software Foundation; either version 2 of the License, or
     10# (at your option) any later version.
     11#
     12# This program is distributed in the hope that it will be useful,
     13# but WITHOUT ANY WARRANTY; without even the implied warranty of
     14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15# GNU General Public License for more details.
     16#
     17# You should have received a copy of the GNU General Public License
     18# along with this program; if not, write to the Free Software
     19# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     20#
    321
    422MAXTEST=2; export MAXTEST
  • trunk/test/testrun_1c.sh

    r21 r27  
    11#! /bin/sh
     2
     3#
     4# Copyright Rainer Wichmann (2006)
     5#
     6# License Information:
     7# This program is free software; you can redistribute it and/or modify
     8# it under the terms of the GNU General Public License as published by
     9# the Free Software Foundation; either version 2 of the License, or
     10# (at your option) any later version.
     11#
     12# This program is distributed in the hope that it will be useful,
     13# but WITHOUT ANY WARRANTY; without even the implied warranty of
     14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15# GNU General Public License for more details.
     16#
     17# You should have received a copy of the GNU General Public License
     18# along with this program; if not, write to the Free Software
     19# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     20#
    221
    322BUILDOPTS="--quiet $TRUST --enable-xml-log --enable-suidcheck --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"
  • trunk/test/testrun_2.sh

    r22 r27  
    11#! /bin/sh
     2
     3#
     4# Copyright Rainer Wichmann (2006)
     5#
     6# License Information:
     7# This program is free software; you can redistribute it and/or modify
     8# it under the terms of the GNU General Public License as published by
     9# the Free Software Foundation; either version 2 of the License, or
     10# (at your option) any later version.
     11#
     12# This program is distributed in the hope that it will be useful,
     13# but WITHOUT ANY WARRANTY; without even the implied warranty of
     14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15# GNU General Public License for more details.
     16#
     17# You should have received a copy of the GNU General Public License
     18# along with this program; if not, write to the Free Software
     19# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     20#
    221
    322LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
     
    1635        rm -f test_log_valgrind
    1736
    18         ${VALGRIND} ./yule -l info -p none >/dev/null 2>>test_log_valgrind &
     37        ${VALGRIND} ./yule.2 -l info -p none >/dev/null 2>>test_log_valgrind &
     38        PROC_Y2=$!
     39        sleep 5
     40
     41        [ -z "$verbose" ] || {
     42            echo;
     43            echo "${S}Start Server #2${E}: ./yule.2 -l info -p none &";
     44            echo;
     45        }
     46
     47        ${VALGRIND} ./yule -l info -p none -e info --bind-address=127.0.0.1 \
     48            --server-port=49778 >/dev/null 2>>test_log_valgrind &
    1949        PROC_Y=$!
    2050        sleep 5
     
    3262            [ -z "$quiet" ]   && log_msg_fail  "samhain.new -t check";
    3363            kill $PROC_Y
     64            kill $PROC_Y2
    3465            return 1
    3566        fi
    3667
    3768        kill $PROC_Y
    38         sleep 5
     69        kill $PROC_Y2
     70        sleep 5
     71
     72        # cp ${LOGFILE}  triple_test
     73        # cp ${LOGFILE}2 triple_test_2
     74
     75        egrep "START(>|\").*Yule(>|\")" ${LOGFILE}2 >/dev/null 2>&1
     76        if [ $? -ne 0 ]; then
     77            [ -z "$verbose" ] || log_msg_fail "Server #2 start";
     78            return 1
     79        fi
     80        egrep "remote_host.*Checking.*/bin" ${LOGFILE}2 >/dev/null 2>&1
     81        if [ $? -ne 0 ]; then
     82            [ -z "$verbose" ] || log_msg_fail "Client file check (relayed)";
     83            return 1
     84        fi
     85        egrep "remote_host.*EXIT.*Samhain" ${LOGFILE}2 >/dev/null 2>&1
     86        if [ $? -ne 0 ]; then
     87            [ -z "$verbose" ] || log_msg_fail "Client exit (relayed)";
     88            return 1
     89        fi
     90        egrep "EXIT.*Yule.*SIGTERM" ${LOGFILE}2 >/dev/null 2>&1
     91        if [ $? -ne 0 ]; then
     92            [ -z "$verbose" ] || log_msg_fail "Server #2 exit";
     93            return 1
     94        fi
     95
    3996
    4097        egrep "START(>|\").*Yule(>|\")" $LOGFILE >/dev/null 2>&1
     
    195252        rm -f test_log_valgrind
    196253
    197         ${VALGRIND} ./yule -p none >/dev/null 2>>test_log_valgrind &
     254        ${VALGRIND} ./yule -p none -e none >/dev/null 2>>test_log_valgrind &
    198255        PROC_Y=$!
    199256        sleep 5
     
    292349        rm -f test_log_valgrind
    293350
    294         ${VALGRIND} ./yule -l info -p none >/dev/null 2>>test_log_valgrind &
     351        ${VALGRIND} ./yule -l info -p none -e none \
     352            >/dev/null 2>>test_log_valgrind &
    295353        PROC_Y=$!
    296354        sleep 5
     
    427485) >entry.html
    428486
    429         ${VALGRIND} ./yule -l info -p none >/dev/null 2>>test_log_valgrind &
     487        ${VALGRIND} ./yule -l info -p none -e none \
     488            >/dev/null 2>>test_log_valgrind &
    430489        PROC_Y=$!
    431490        sleep 5
    432491
    433492        egrep '<!-- head -->' $HTML >/dev/null 2>&1
     493        if [ $? -ne 0 ]; then
     494            # rm -f head.html; rm -f foot.html; rm -f entry.html;
     495            kill $PROC_Y
     496            [ -z "$verbose" ] || log_msg_fail "head.html (1)";
     497            return 1
     498        fi
     499
     500        egrep '<!-- foot -->' $HTML >/dev/null 2>&1
    434501        if [ $? -ne 0 ]; then
    435502            rm -f head.html; rm -f foot.html; rm -f entry.html;
    436503            kill $PROC_Y
    437             [ -z "$verbose" ] || log_msg_fail "head.html";
    438             return 1
    439         fi
    440 
    441         egrep '<!-- foot -->' $HTML >/dev/null 2>&1
    442         if [ $? -ne 0 ]; then
    443             rm -f head.html; rm -f foot.html; rm -f entry.html;
    444             kill $PROC_Y
    445             [ -z "$verbose" ] || log_msg_fail "foot.html";
     504            [ -z "$verbose" ] || log_msg_fail "foot.html (1)";
    446505            return 1
    447506        fi
     
    500559        egrep '<!-- ehead -->' $HTML >/dev/null 2>&1
    501560        if [ $? -ne 0 ]; then
    502             [ -z "$verbose" ] || log_msg_fail "head.html";
     561            [ -z "$verbose" ] || log_msg_fail "end head.html";
    503562            return 1
    504563        fi
     
    511570        egrep '<!-- eentry -->' $HTML >/dev/null 2>&1
    512571        if [ $? -ne 0 ]; then
    513             [ -z "$verbose" ] || log_msg_fail "entry.html";
     572            [ -z "$verbose" ] || log_msg_fail "end entry.html";
    514573            return 1
    515574        fi
     
    522581        egrep '<!-- efoot -->' $HTML >/dev/null 2>&1
    523582        if [ $? -ne 0 ]; then
    524             [ -z "$verbose" ] || log_msg_fail "foot.html";
     583            [ -z "$verbose" ] || log_msg_fail "end foot.html";
    525584            return 1
    526585        fi
     
    571630        fi
    572631
    573         # save binary and build server
     632        # save binary and build server2
    574633        #
    575634        cp samhain samhain.build || return 1
    576635        make clean >/dev/null || return 1
    577636
    578         ${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-data-file=$PW_DIR/.samhain_file --with-html-file=$HTML --enable-encrypt=2
     637        ${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
    579638        #
    580639        if test x$? = x0; then
     
    593652        fi
    594653
     654        # save binary and build server
     655        #
     656        cp yule yule.2 || return 1
     657        make clean >/dev/null || return 1
     658
     659        ${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
     660        #
     661        if test x$? = x0; then
     662                [ -z "$verbose" ] ||     log_msg_ok "configure...";
     663                $MAKE  > /dev/null 2>>test_log
     664                if test x$? = x0; then
     665                    [ -z "$verbose" ] || log_msg_ok "make...";
     666                else
     667                    [ -z "$quiet" ] &&   log_msg_fail "make...";
     668                    return 1
     669                fi
     670
     671        else
     672                [ -z "$quiet" ] &&       log_msg_fail "configure...";
     673                return 1
     674        fi
     675
    595676
    596677        #####################################################################
     
    633714        mv samhain.build.new  samhain.new || return 1
    634715
    635         rm -f ./.samhain_log.*
    636         rm -f ./.samhain_lock
     716        # Set in server
     717
     718        ./samhain_setpwd yule new $SHPW >/dev/null
     719
     720        if test x$? = x0; then
     721            [ -z "$verbose" ] || log_msg_ok    "./samhain_setpwd yule new $SHPW";
     722        else
     723            [ -z "$quiet" ]   && log_msg_fail  "./samhain_setpwd yule new $SHPW";
     724            return 1
     725        fi
     726
     727        mv yule.new yule || return 1
     728
     729        #
     730
     731        rm -f ./.samhain_log*
     732        rm -f ./.samhain_lock*
    637733
    638734        SHCLT=`./yule -P $SHPW | sed s%HOSTNAME%${SH_LOCALHOST}%`
     
    646742
    647743        echo $SHCLT >> testrc_2
     744        cp testrc_2 testrc_22
    648745
    649746        do_test_1
  • trunk/test/testrun_2a.sh

    r25 r27  
    11#! /bin/sh
     2
     3#
     4# Copyright Rainer Wichmann (2006)
     5#
     6# License Information:
     7# This program is free software; you can redistribute it and/or modify
     8# it under the terms of the GNU General Public License as published by
     9# the Free Software Foundation; either version 2 of the License, or
     10# (at your option) any later version.
     11#
     12# This program is distributed in the hope that it will be useful,
     13# but WITHOUT ANY WARRANTY; without even the implied warranty of
     14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15# GNU General Public License for more details.
     16#
     17# You should have received a copy of the GNU General Public License
     18# along with this program; if not, write to the Free Software
     19# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     20#
    221
    322LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
  • trunk/test/testrun_2b.sh

    r22 r27  
    11#! /bin/sh
     2
     3#
     4# Copyright Rainer Wichmann (2006)
     5#
     6# License Information:
     7# This program is free software; you can redistribute it and/or modify
     8# it under the terms of the GNU General Public License as published by
     9# the Free Software Foundation; either version 2 of the License, or
     10# (at your option) any later version.
     11#
     12# This program is distributed in the hope that it will be useful,
     13# but WITHOUT ANY WARRANTY; without even the implied warranty of
     14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15# GNU General Public License for more details.
     16#
     17# You should have received a copy of the GNU General Public License
     18# along with this program; if not, write to the Free Software
     19# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     20#
    221
    322LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
  • trunk/test/testrun_2c.sh

    r19 r27  
    11#! /bin/sh
     2
     3#
     4# Copyright Rainer Wichmann (2006)
     5#
     6# License Information:
     7# This program is free software; you can redistribute it and/or modify
     8# it under the terms of the GNU General Public License as published by
     9# the Free Software Foundation; either version 2 of the License, or
     10# (at your option) any later version.
     11#
     12# This program is distributed in the hope that it will be useful,
     13# but WITHOUT ANY WARRANTY; without even the implied warranty of
     14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15# GNU General Public License for more details.
     16#
     17# You should have received a copy of the GNU General Public License
     18# along with this program; if not, write to the Free Software
     19# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     20#
    221
    322SERVER_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
  • trunk/test/testrun_2d.sh

    r22 r27  
    11#! /bin/sh
     2
     3#
     4# Copyright Rainer Wichmann (2006)
     5#
     6# License Information:
     7# This program is free software; you can redistribute it and/or modify
     8# it under the terms of the GNU General Public License as published by
     9# the Free Software Foundation; either version 2 of the License, or
     10# (at your option) any later version.
     11#
     12# This program is distributed in the hope that it will be useful,
     13# but WITHOUT ANY WARRANTY; without even the implied warranty of
     14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15# GNU General Public License for more details.
     16#
     17# You should have received a copy of the GNU General Public License
     18# along with this program; if not, write to the Free Software
     19# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     20#
    221
    322SERVER_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
  • trunk/test/testtimesrv.sh

    r19 r27  
    11#! /bin/sh
     2
     3#
     4# Copyright Rainer Wichmann (2006)
     5#
     6# License Information:
     7# This program is free software; you can redistribute it and/or modify
     8# it under the terms of the GNU General Public License as published by
     9# the Free Software Foundation; either version 2 of the License, or
     10# (at your option) any later version.
     11#
     12# This program is distributed in the hope that it will be useful,
     13# but WITHOUT ANY WARRANTY; without even the implied warranty of
     14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15# GNU General Public License for more details.
     16#
     17# You should have received a copy of the GNU General Public License
     18# along with this program; if not, write to the Free Software
     19# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     20#
    221
    322RCFILE="$PW_DIR/testrc_1.dyn";  export RCFILE
Note: See TracChangeset for help on using the changeset viewer.