Changeset 29


Ignore:
Timestamp:
Apr 11, 2006, 1:48:18 PM (19 years ago)
Author:
rainer
Message:

Fixes for test suite, OpenBSD portability, self-resolving, and suidchk patch by Neil

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/Changelog

    r27 r29  
    112.2.0:
     2        * patch by Neil Gorsuch for suidchk.c (do not scan lustre, afs, mmfs)
     3        * fix sh_ext_popen (OpenBSD needs non-null argv[0] in execve)
     4        * fix make_tests.sh portability (echo '"\n"' does not work on OpenBSD)
     5        * fix bug in sh_utils_obscurename (check isascii)
     6        * scan h_aliases for FQDN if h_name is not
    27        * add copyright/license info to test scripts
    38        * add copyright/license info to deployment system scripts
    49        * support server-to-server relay
    5         * new CL option --server-port
     10        * new CL option --server-port 
    611        * minor improvements in manual
    712        * patch by Yoann Vandoorselaere for sh_prelude.c
    813        * allow --longopt arg as well as --longopt=arg
    9         * verify checksum of growing log files
     14        * verify checksum of growing log files (up to previous size)
    1015        * rewrite of the test suite
    1116        * added a bit of unit testing
  • trunk/scripts/README

    r1 r29  
    4040   This script will do this automatically. Run 'samhainrc_update.sh -h'
    4141   for usage instructions. You may need to change the location of the
    42    samhainrc file by editing the line 'SAMHAIN_CFG="/etc/samhainrc"'
     42   samhainrc file by editing the line 'cfgfile="/etc/samhainrc"'
    4343   at the beginning of the script.
    4444 
  • trunk/scripts/samhainrc_update.sh

    r1 r29  
    1 #!/bin/bash
    2 # -----------------------------------------------------------------------------
    3 # @brief: update the kernel options in the samhain configuration
    4 #         file, after a new kernel has been compiled
    5 # @author: marc heisterkamp <marzheister@web.de>
    6 # -----------------------------------------------------------------------------
    7 
    8 SAMHAIN_CFG="/etc/samhainrc"
    9 
    10 BLUE="[34;01m"
    11 CYAN="[36;01m"
    12 GREEN="[32;01m"
    13 DARK_GREEN="[32m"
    14 RED="[31;01m"
    15 PURPLE="[35;01m"
    16 WHITE="[37;01m"
    17 DARK_GRAY="[30;01m"
    18 LIGHT_GRAY="[37m"
    19 YELLOW="[33;01m"
    20 BROWN="[33m"
    21 OFF="[0m"
    22 
    23 
    24 SYSTEM_MAP=""
    25 new_cfg=''
    26 scriptname="$0"
    27 
    28 # global variables for system adresses (extracted from System.map)
    29 SYS_CALL=''
    30 SYS_CALL_TABLE=''
    31 PROC_ROOT=''
    32 PROC_ROOT_IOPS=''
    33 PROC_ROOT_LOOKUP=''
    34 
    35 # Make sure the user has root permissions
    36 if [ $UID -ne 0 ] ; then
    37   echo "You must be root to run this script. Exiting."
    38   exit 1
     1#! /bin/sh
     2
     3# -----------------------------------------------------------------------
     4# The default configuration file
     5# -----------------------------------------------------------------------
     6
     7cfgfile="/etc/samhainrc"
     8
     9# -----------------------------------------------------------------------
     10# Be Bourne compatible
     11# -----------------------------------------------------------------------
     12
     13if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
     14  emulate sh
     15  NULLCMD=:
     16elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
     17  set -o posix
    3918fi
    4019
    41 
    42 #------------------------------------------------------------------------------
    43 # usage
    44 #------------------------------------------------------------------------------
    45 function print_usage() {
    46 
    47   cat >&2 <<EOHELP
    48 
    49   update the samhainrc configuration file with new kernel system addresses
    50   (i.e: after kernel compilation) by extracting these from the new System.map
    51   file
    52 
    53   SYNOPSIS
    54      $scriptname [ ${GREEN}--help${OFF} ]
    55                            [ ${GREEN}--nocolor${OFF} ]
    56                            [ ${GREEN}--print-only${OFF} ] <System.map>
    57                            [ ${GREEN}--update${OFF} ]     <System.map>
    58 
    59   OPTIONS
    60      ${GREEN}-h${OFF} ${GREEN}--help${OFF}
    61         Show help.
    62 
    63      ${GREEN}--nocolor${OFF}
    64         Disable color hilighting for non ANSI-compatible terms.
    65 
    66      ${GREEN}-p${OFF} ${GREEN}--print-only${OFF} <System.map>
    67         Print the extracted system adresses and do not write them to the
    68         samhain configuration file.
    69 
    70      ${GREEN}-u${OFF} ${GREEN}--update${OFF} <System.map>
    71         Update the samhainrc configuration file with new kernel system
    72         addresses from the given System.map file
    73 
    74 EOHELP
    75  exit 0
    76 }
    77 
    78 
    79 #------------------------------------------------------------------------------
    80 # parses the command line options
    81 # param in: all parameters given to the script
    82 #------------------------------------------------------------------------------
    83 function parse_cmd_line() {
    84 
    85   # parse the command-line
    86   while [ -n "$1" ]; do
    87     case "$1" in
    88       --help|-h)
    89         print_usage
    90         ;;
    91       --nocolor|-n)
    92         unset DARK_GREEN GREEN RED BROWN LIGHT_GRAY WHITE OFF
    93         ;;
    94       --print-only|-p)
    95         shift
    96         SYSTEM_MAP="$1"
    97         get_system_addresses
    98         print_system_addresses
    99         break
    100         ;;
    101       --update|-u)
    102         shift
    103         SYSTEM_MAP="$1"
    104         get_system_addresses
    105         print_system_addresses
    106         replace_system_addresses
    107         ;;
    108       -*)
    109         echo "$scriptname: unknown option $1. Exiting" >&2
    110         exit 1
    111         ;;
    112     esac
    113     shift
    114   done
    115 }
    116 
    117 
    118 #------------------------------------------------------------------------------
    119 # extract system adresses from given System.map file and save to global
    120 # variables
    121 #------------------------------------------------------------------------------
    122 function get_system_addresses() {
    123 
    124   if [ -z "$SYSTEM_MAP" ] ; then
    125     echo
    126     echo "No System.map specified. Exiting" >&2
    127     echo
    128     exit 1
     20programname="$0"
     21sysmap=
     22
     23# -----------------------------------------------------------------------
     24# Print help
     25# -----------------------------------------------------------------------
     26
     27showhelp() {
     28    echo
     29    echo "$programname - update samhain config file after kernel update"
     30    echo
     31    echo "OPTIONS:"
     32    echo
     33    echo " -u|--update </path/to/System.map>"
     34    echo "         Update the configuration file with new"
     35    echo "         settings as taken from </path/to/System.map>"
     36    echo
     37    echo " -c|--config-file </path/to/config-file>"
     38    echo "         Specify the configuration file to update [${cfgfile}]"
     39    echo
     40    echo " -p|--print-only </path/to/System.map>"
     41    echo "         Print new settings, don't modify anything"
     42    echo
     43    echo " -h|--help"
     44    echo "         Print this help"
     45    echo
     46    echo " -n|--nocolor"
     47    echo "         (ignored, legacy support)"
     48    echo
     49}
     50
     51
     52# -----------------------------------------------------------------------
     53# Death strikes
     54# -----------------------------------------------------------------------
     55
     56die() {
     57    echo ${1+"$@"} >&2
     58    { (exit 1); exit 1; }
     59}
     60
     61# -----------------------------------------------------------------------
     62# Get new settings from </path/to/System.map>
     63# -----------------------------------------------------------------------
     64
     65system_call=
     66syscall_table=
     67proc_root=
     68proc_root_inode_operations=
     69proc_root_lookup=
     70
     71get_new_settings() {
     72
     73    if [ -z "$sysmap" ]; then
     74        die "No System.map specified"
     75    fi
     76    if [ -f "$sysmap" ]; then
     77        if [ -r "$sysmap" ]; then
     78            system_call=`egrep '[[:alnum:]]{8}[[:space:]]+[[:alpha:]]{1}[[:space:]]+system_call$' ${sysmap} | awk '{ print $1 }'`
     79            syscall_table=`egrep '[[:alnum:]]{8}[[:space:]]+[[:alpha:]]{1}[[:space:]]+sys_call_table$' ${sysmap} | awk '{ print $1 }'`
     80            proc_root=`egrep '[[:alnum:]]{8}[[:space:]]+[[:alpha:]]{1}[[:space:]]+proc_root$' ${sysmap} | awk '{ print $1 }'`
     81            proc_root_inode_operations=`egrep '[[:alnum:]]{8}[[:space:]]+[[:alpha:]]{1}[[:space:]]+proc_root_inode_operations$' ${sysmap} | awk '{ print $1 }'`
     82            proc_root_lookup=`egrep '[[:alnum:]]{8}[[:space:]]+[[:alpha:]]{1}[[:space:]]+proc_root_lookup$' ${sysmap} | awk '{ print $1 }'`
     83        else
     84            die "System.map ${sysmap} not readable"
     85        fi
     86    else
     87        die "System.map ${sysmap} not found"
     88    fi
     89    test -z "${system_call}" && die "system_call not found in ${cfgfile}"
     90    test -z "${syscall_table}" && die "sys_call_table not found in ${cfgfile}"
     91    test -z "${proc_root}" && die "proc_root not found in ${cfgfile}"
     92    test -z "${proc_root_inode_operations}" && die "proc_root_inode_operations not found in ${cfgfile}"
     93    test -z "${proc_root_lookup}" && die "proc_root_lookup not found in ${cfgfile}"
     94
     95}
     96
     97# -----------------------------------------------------------------------
     98# Print new settings
     99# -----------------------------------------------------------------------
     100
     101run_print() {
     102    get_new_settings
     103    echo
     104    echo "KernelSystemCall =     0x${system_call}"
     105    echo "KernelSyscallTable =   0x${syscall_table}"
     106    echo "KernelProcRoot =       0x${proc_root}"
     107    echo "KernelProcRootIops =   0x${proc_root_inode_operations}"
     108    echo "KernelProcRootLookup = 0x${proc_root_lookup}"
     109    echo
     110}
     111
     112# -----------------------------------------------------------------------
     113# Replace a setting
     114# -----------------------------------------------------------------------
     115
     116# set ignorecase
     117# search pattern
     118# delete current line
     119# insert
     120# single dot == end of insert text
     121# save and exit
     122
     123run_replace() {
     124    item="$1"
     125    address="$2"
     126    ex -s "$cfgfile" <<EOF
     127:set ic
     128:/^[[:blank:]]*$1[[:blank:]]*=
     129:d
     130:i
     131$item = $address
     132.
     133:x
     134EOF
     135}
     136
     137# -----------------------------------------------------------------------
     138# Add a setting
     139# -----------------------------------------------------------------------
     140
     141# set ignorecase
     142# search pattern ([Kernel] section)
     143# append (next line)
     144# single dot == end of insert text
     145# save and exit
     146
     147run_add() {
     148    item="$1"
     149    address="$2"
     150    ex -s "$cfgfile" <<EOF
     151:set ic
     152:/^[[:space:]]*\[Kernel\]
     153:a
     154$item = $address
     155.
     156:x
     157EOF
     158}
     159
     160# -----------------------------------------------------------------------
     161# Update with new settings
     162# -----------------------------------------------------------------------
     163
     164run_update() {
     165
     166    get_new_settings
     167
     168    if [ -z "$cfgfile" ]; then
     169        die "No configuration file specified"
     170    fi
     171    if [ ! -w "$cfgfile" ]; then
     172        die "Configuration file ${cfgfile} not writeable"
     173    fi
     174    egrep '^[[:space:]]*\[Kernel\]' "$cfgfile" >/dev/null
     175    if [ $? -ne 0 ]; then
     176        die "No [Kernel] section in configuration file $cfgfile"
     177    fi
     178
     179    cat "$cfgfile" | egrep -i 'KernelProcRootLookup' >/dev/null
     180    if [ $? -eq 0 ]; then
     181        run_replace 'KernelProcRootLookup' "0x${proc_root_lookup}"
     182    else
     183        run_add 'KernelProcRootLookup' "0x${proc_root_lookup}"
     184    fi
     185 
     186    cat "$cfgfile" | egrep -i 'KernelProcRootIops' >/dev/null
     187    if [ $? -eq 0 ]; then
     188        run_replace 'KernelProcRootIops' "0x${proc_root_inode_operations}"
     189    else
     190        run_add 'KernelProcRootIops' "0x${proc_root_inode_operations}"
     191    fi
     192
     193    cat "$cfgfile" | egrep -i 'KernelProcRoot[[:space:]]*=' >/dev/null
     194    if [ $? -eq 0 ]; then
     195        run_replace 'KernelProcRoot' "0x${proc_root}"
     196    else
     197        run_add 'KernelProcRoot' "0x${proc_root}"
     198    fi
     199
     200    cat "$cfgfile" | egrep -i 'KernelSyscallTable' >/dev/null
     201    if [ $? -eq 0 ]; then
     202        run_replace 'KernelSyscallTable' "0x${syscall_table}"
     203    else
     204        run_add 'KernelSyscallTable' "0x${syscall_table}"
     205    fi
     206
     207    cat "$cfgfile" | egrep -i 'KernelSystemCall' >/dev/null
     208    if [ $? -eq 0 ]; then
     209        run_replace 'KernelSystemCall' "0x${system_call}"
     210    else
     211        run_add 'KernelSystemCall' "0x${system_call}"
     212    fi
     213
     214}
     215
     216# -----------------------------------------------------------------------
     217# Parse command line
     218# -----------------------------------------------------------------------
     219
     220sysmap=
     221action=
     222
     223for option
     224do
     225
     226  # If the previous option needs an argument, assign it.
     227  #
     228  if test -n "$opt_prev"; then
     229    eval "$opt_prev=\$option"
     230    eval export "$opt_prev"
     231    opt_prev=
     232    continue
    129233  fi
    130234
    131   if [ ! -f "$SYSTEM_MAP" ] ; then
    132     echo
    133     echo "Could not find System.map: $SYSTEM_MAP. Exiting" >&2
    134     echo
    135     exit 1
    136   fi
    137 
    138   # 1. this is the address of system_call (grep system_call System.map)
    139   #    KernelSystemCall = 0xc0106cf8
    140   SYS_CALL="0x`grep system_call $SYSTEM_MAP | cut -d' ' -f1`"
    141 
    142   # 2. this is the address of sys_call_table (grep ' sys_call_table' System.map)
    143   #    KernelSyscallTable = 0xc01efb98
    144   SYS_CALL_TABLE="0x`grep sys_call_table $SYSTEM_MAP | cut -d' ' -f1`"
    145 
    146   # 3. this is the address of proc_root (grep ' proc_root$' System.map)
    147   #    KernelProcRoot = 0xc01efb98
    148   PROC_ROOT="0x`grep ' proc_root$' $SYSTEM_MAP | cut -d' ' -f1`"
    149 
    150   # 4. this is the address of proc_root_inode_operations
    151   #    (grep proc_root_inode_operations System.map)
    152   #    KernelProcRootIops = 0xc01efb98
    153   PROC_ROOT_IOPS="0x`grep proc_root_inode_operations $SYSTEM_MAP | cut -d' ' -f1`"
    154 
    155   # 5. this is the address of proc_root_lookup
    156   #    (grep proc_root_lookup System.map)
    157   #    KernelProcRootLookup = 0xc01efb98
    158   PROC_ROOT_LOOKUP="0x`grep proc_root_lookup $SYSTEM_MAP | cut -d' ' -f1`"
    159 }
    160 
    161 
    162 #------------------------------------------------------------------------------
    163 # extract system adresses from given System.map file and save to global
    164 # variables
    165 #------------------------------------------------------------------------------
    166 function replace_system_addresses() {
    167 
    168   if [ -z "$SAMHAIN_CFG" ] ; then
    169     echo "Could not find your samhainrc config file: $SAMHAIN_CFG. Exiting" >&2
    170     exit 1
    171   fi
    172 
    173   echo
    174   echo "Replacing current kernel system addresses in: $SAMHAIN_CFG"
    175 
    176   # 1. replace current 'KernelSystemCall' setting
    177   new_cfg=`sed -e "s/^\(KernelSystemCall[[:blank:]]*=\)[[:blank:]]*\(.*\)/\1 ${SYS_CALL}/" $SAMHAIN_CFG`
    178 
    179   # 2. replace current 'KernelSyscallTable' setting
    180   new_cfg=`echo "$new_cfg" | sed -e "s/^\(KernelSyscallTable[[:blank:]]*=\)[[:blank:]]*\(.*\)/\1 ${SYS_CALL_TABLE}/"`
    181 
    182   # 3. replace current 'KernelProcRoot' setting
    183   new_cfg=`echo "$new_cfg" | sed -e "s/^\(KernelProcRoot[[:blank:]]*=\)[[:blank:]]*\(.*\)/\1 ${PROC_ROOT}/"`
    184 
    185   # 4. replace current 'KernelProcRootIops' setting
    186   new_cfg=`echo "$new_cfg" | sed -e "s/^\(KernelProcRootIops[[:blank:]]*=\)[[:blank:]]*\(.*\)/\1 ${PROC_ROOT_IOPS}/"`
    187 
    188   # 5. replace current 'KernelSystemCall' setting
    189   new_cfg=`echo "$new_cfg" | sed -e "s/^\(KernelProcRootLookup[[:blank:]]*=\)[[:blank:]]*\(.*\)/\1 ${PROC_ROOT_LOOKUP}/"`
    190 
    191   echo "Backup old samhainrc $SAMHAIN_CFG to $SAMHAIN_CFG.bak"
    192 
    193   # backup old samhainrc config file
    194   mv "$SAMHAIN_CFG" "$SAMHAIN_CFG.bak"
    195 
    196   # write new samhainrc config file
    197   echo "$new_cfg" > "$SAMHAIN_CFG"
    198 
    199   echo "Successfully updated kernel system addresses."
    200   echo
    201 }
    202 
    203 
    204 #------------------------------------------------------------------------------
    205 # print samhain required system adresses
    206 #------------------------------------------------------------------------------
    207 function print_system_addresses() {
    208 
    209   echo
    210   echo "your kernel system addresses from: `basename $SYSTEM_MAP`"
    211   echo
    212   echo "  KernelSystemCall     = $SYS_CALL"
    213   echo "  KernelSyscallTable   = $SYS_CALL_TABLE"
    214   echo "  KernelProcRoot       = $PROC_ROOT"
    215   echo "  KernelProcRootIops   = $PROC_ROOT_IOPS"
    216   echo "  KernelProcRootLookup = $PROC_ROOT_LOOKUP"
    217   echo
    218 
    219 }
    220 
    221 if [ $# -eq 0 ] ; then
    222   print_usage
     235  case "$option" in
     236      -*=*)
     237          optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'`
     238          ;;
     239      *)
     240          optarg=
     241          ;;
     242  esac
     243
     244  case "$option" in
     245
     246      -h|--help)
     247          showhelp
     248          exit 0
     249          ;;
     250
     251      -n|--nocolor)
     252          ;;
     253
     254      -c|--config-file)
     255          opt_prev=cfgfile
     256          ;;
     257
     258      -c=* | --config-file=*)
     259          cfgfile="$optarg"
     260          ;;
     261
     262      -p|--print-only)
     263          opt_prev=sysmap
     264          action=p
     265          ;;
     266
     267
     268      -p=* | --print-only=*)
     269          sysmap="$optarg"
     270          action=p
     271          ;;
     272   
     273      -u|--update)
     274          opt_prev=sysmap
     275          action=u
     276          ;;
     277
     278      -u=* | --update=*)
     279          sysmap="$optarg"
     280          action=u
     281          ;;
     282
     283  esac
     284
     285done
     286
     287if [ x"$action" = xp ]; then
     288    run_print
     289    exit 0
    223290fi
    224 
    225 parse_cmd_line $*
    226 
    227 exit 0
     291if [ x"$action" = xu ]; then
     292    run_update
     293    exit 0
     294fi
     295
     296showhelp
     297exit 1
  • trunk/src/make-tests.sh

    r19 r29  
    4949    CuSuiteDetails(suite, output);
    5050    if (suite->failCount > 0)
    51       fprintf(stderr, "%s\n", output->buffer);
     51      fprintf(stderr, "%s%c", output->buffer, 0x0A);
    5252    else
    53       fprintf(stdout, "%s\n", output->buffer);
     53      fprintf(stdout, "%s%c", output->buffer, 0x0A);
    5454    return suite->failCount;
    5555}
  • trunk/src/sh_extern.c

    r22 r29  
    115115  FILE * outf = NULL;
    116116  char * envp[1];
    117   char * argp[1];
     117  char * argp[2];
    118118
    119119  char * errfile;
     
    133133   *         needs a valid *envp[] with envp[0] = NULL;
    134134   *         and similarly for argp
     135   * OpenBSD finally needs non-null argp[0] ...
    135136   */
     137  argp[0] = task->command;
     138  argp[1] = NULL;
    136139  envp[0] = NULL;
    137   argp[0] = NULL;
    138140
    139141  /*
  • trunk/src/sh_suidchk.c

    r22 r29  
    525525              fs = filesystem_type (tmpcat, tmpcat, &buf);
    526526              if (fs != NULL &&
     527                  0 != strncmp (_("afs"),     fs, 3) &&
     528                  0 != strncmp (_("devfs"),   fs, 5) &&
     529                  0 != strncmp (_("iso9660"), fs, 7) &&
     530                  0 != strncmp (_("lustre"),  fs, 6) &&
     531                  0 != strncmp (_("mmfs"),    fs, 4) &&
     532                  0 != strncmp (_("msdos"),   fs, 5) &&
    527533                  0 != strncmp (_("nfs"),     fs, 3) &&
     534                  0 != strncmp (_("nosuid"),  fs, 6) &&
    528535                  0 != strncmp (_("proc"),    fs, 4) &&
    529                   0 != strncmp (_("iso9660"), fs, 7) &&
    530                   0 != strncmp (_("vfat"),    fs, 4) &&
    531                   0 != strncmp (_("msdos"),   fs, 5) &&
    532                   0 != strncmp (_("devfs"),   fs, 5) &&
    533                   0 != strncmp (_("nosuid"),  fs, 6)
     536                  0 != strncmp (_("vfat"),    fs, 4)
    534537                  )
    535538                {
  • trunk/src/sh_unix.c

    r27 r29  
    14511451#include <arpa/inet.h>
    14521452
     1453char * sh_unix_h_name (struct hostent * host_entry)
     1454{
     1455        char ** p;
     1456        if (strchr(host_entry->h_name, '.')) {
     1457                return host_entry->h_name;
     1458        } else {
     1459                for (p = host_entry->h_aliases; *p; ++p) {
     1460                        if (strchr(*p, '.'))
     1461                                return *p;
     1462                }
     1463        }
     1464        return host_entry->h_name;
     1465}
     1466
    14531467/* uname() on FreeBSD is broken, because the 'nodename' buf is too small
    14541468 * to hold a valid (leftmost) domain label.
     
    15211535  else
    15221536    {
    1523       sl_strlcpy (sh.host.name, he1->h_name, SH_PATHBUF);
     1537      sl_strlcpy (sh.host.name, sh_unix_h_name(he1), SH_PATHBUF);
    15241538    }
    15251539 
     
    15691583  if (he1 != NULL)
    15701584    {
    1571       sl_strlcpy (sh.host.name, he1->h_name, SH_PATHBUF);
     1585      sl_strlcpy (sh.host.name, sh_unix_h_name(he1), SH_PATHBUF);
    15721586    }
    15731587  else
  • trunk/src/sh_utils.c

    r25 r29  
    13401340  char * endptr = NULL;
    13411341
    1342   SL_ENTER(_("sh_util_obscure_ex"));
     1342  SL_ENTER(_("sh_util_obscure_ok"));
    13431343
    13441344  if (0 == sl_strncmp("all", str, 3))
     
    13481348          sh_obscure_index[i] = (unsigned char)1;
    13491349        }
    1350       SL_RETURN(0, _("sh_util_obscure_ex"));
     1350      SL_RETURN(0, _("sh_util_obscure_ok"));
    13511351    }
    13521352
     
    13591359  if (i > 255)
    13601360    {
    1361       SL_RETURN(-1, _("sh_util_obscure_ex"));
     1361      SL_RETURN(-1, _("sh_util_obscure_ok"));
    13621362    }
    13631363  sh_obscure_index[i] = (unsigned char)1;
     
    13701370      if (i > 255)
    13711371        {
    1372           SL_RETURN(-1, _("sh_util_obscure_ex"));
     1372          SL_RETURN(-1, _("sh_util_obscure_ok"));
    13731373        }
    13741374      sh_obscure_index[i] = (unsigned char)1;
     
    13761376        ++endptr;
    13771377    }
    1378   SL_RETURN(0, _("sh_util_obscure_ex"));
     1378  SL_RETURN(0, _("sh_util_obscure_ok"));
    13791379}
    13801380
    13811381int sh_util_obscurename (ShErrLevel level, char * name_orig, int flag)
    13821382{
    1383   char * name = name_orig;
     1383  unsigned char * name = (unsigned char *) name_orig;
    13841384  char * safe;
    13851385  unsigned int i;
     
    13931393  while (*name != '\0')
    13941394    {
    1395       if ( (*name) == '"'  || (*name) == '\t' ||
     1395      if ( (*name) >  0x7F || (*name) == '"'  || (*name) == '\t' ||
    13961396           (*name) == '\b' || (*name) == '\f' ||
    13971397           (*name) == '\n' || (*name) == '\r' ||
  • trunk/src/slib.c

    r25 r29  
    19841984    {
    19851985      TPT((0, FIL__, __LINE__,
    1986            _("msg=<Error closing file.>, path=<%s>, fd=<%d>\n"),
    1987            ofiles[fd]->path, fd));
     1986           _("msg=<Error closing file.>, path=<%s>, fd=<%d>, err=<%s>\n"),
     1987           ofiles[fd]->path, fd, strerror(errno)));
    19881988    }
    19891989
  • trunk/test/test.sh

    r27 r29  
    185185
    186186PW_DIR=`pwd`; export PW_DIR
     187
     188#
     189# group/world writeable will cause problems
     190#
     191chmod go-w .
    187192#
    188193#
  • trunk/test/testcompile.sh

    r27 r29  
    223223        if [ -z "$GPG" ]; then
    224224            log_skip $num $MAXTEST 'gpg not in PATH'
     225            let "num = num + 1" >/dev/null
    225226        else
    226227            if test -r "Makefile"; then
     
    370371        if [ -z "$GPG" ]; then
    371372            log_skip $num $MAXTEST 'gpg not in PATH'
    372             let "num = num + 1" >/dev/null
    373             log_skip $num $MAXTEST 'gpg not in PATH'
     373            let "num = num + 3" >/dev/null
    374374        else
    375375            if test -r "Makefile"; then
  • trunk/test/testrun_2.sh

    r27 r29  
    732732        rm -f ./.samhain_lock*
    733733
    734         SHCLT=`./yule -P $SHPW | sed s%HOSTNAME%${SH_LOCALHOST}%`
     734        SHCLT=`./yule -P $SHPW`
    735735
    736736        if test x$? = x0; then
     
    741741        fi
    742742
    743         echo $SHCLT >> testrc_2
     743        SHCLT1=`echo "${SHCLT}"  | sed s%HOSTNAME%${SH_LOCALHOST}%`
     744        AHOST=`find_hostname`
     745        SHCLT2=`echo "${SHCLT}"  | sed s%HOSTNAME%${AHOST}%`
     746       
     747
     748        echo $SHCLT1 >> testrc_2
     749        echo $SHCLT2 >> testrc_2
    744750        cp testrc_2 testrc_22
    745751
  • trunk/test/testrun_2a.sh

    r27 r29  
    197197        rm -f ./.samhain_lock
    198198
    199         SHCLT=`./yule -P $SHPW | sed s%HOSTNAME%${SH_LOCALHOST}%`
     199        SHCLT=`./yule -P $SHPW`
    200200
    201201        if test x$? = x0; then
     
    206206        fi
    207207
    208         echo $SHCLT >> testrc_2
     208        SHCLT1=`echo "${SHCLT}"  | sed s%HOSTNAME%${SH_LOCALHOST}%`
     209        AHOST=`find_hostname`
     210        SHCLT2=`echo "${SHCLT}"  | sed s%HOSTNAME%${AHOST}%`
     211       
     212
     213        echo $SHCLT1 >> testrc_2
     214        echo $SHCLT2 >> testrc_2
     215
    209216
    210217        cp    ./testrc_2       ./rc.${SH_LOCALHOST}
  • trunk/test/testrun_2b.sh

    r27 r29  
    144144    rm -f ./.samhain_lock
    145145   
    146     SHCLT=`./yule -P $SHPW | sed s%HOSTNAME%${SH_LOCALHOST}%`
     146    SHCLT=`./yule -P $SHPW`
    147147   
    148148    if test x$? = x0; then
     
    153153    fi
    154154   
    155     echo $SHCLT >> testrc_2
     155    SHCLT1=`echo "${SHCLT}"  | sed s%HOSTNAME%${SH_LOCALHOST}%`
     156    AHOST=`find_hostname`
     157    SHCLT2=`echo "${SHCLT}"  | sed s%HOSTNAME%${AHOST}%`
     158       
     159
     160    echo $SHCLT1 >> testrc_2
     161    echo $SHCLT2 >> testrc_2
     162
    156163   
    157164    cp    "${RCFILE_C}"              ./rc.${SH_LOCALHOST}
Note: See TracChangeset for help on using the changeset viewer.