Changeset 210


Ignore:
Timestamp:
Jan 29, 2009, 7:54:16 PM (16 years ago)
Author:
katerina
Message:

Fix for ticket #136 (compile error); also enhance testsuite to catch compiler warnings.

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.ac

    r209 r210  
    1212dnl start
    1313dnl
    14 AM_INIT_AUTOMAKE(samhain, 2.5.2a)
     14AM_INIT_AUTOMAKE(samhain, 2.5.2b)
    1515AC_DEFINE([SAMHAIN], 1, [Application is samhain])
    1616AC_CANONICAL_HOST
  • trunk/docs/Changelog

    r209 r210  
     12.5.2b (29-01-2009):
     2        * turn warnings into errors in the compile test suite
     3        * fix missing define in sh_portcheck.c to eliminate compiler warning
     4          (reported by joerg)
     5
    162.5.2a (26-01-2009):
    27        * fix problem building deb package (bit rot; reported by joerg)
  • trunk/src/sh_err_log.c

    r170 r210  
    380380                {
    381381                  if (key[0] != '\n' && key[0] != '\0')
    382                     fprintf(stdout, _("New audit trail, enter key: "));
     382                    fprintf(stdout, "%s",_("New audit trail, enter key: "));
    383383                  else if (key[0] == '\n')
    384384                    {
     
    418418                {
    419419                  chk_mode = CHK_KEY;
    420                   fprintf(stdout, _("Key not found in file\n"));
     420                  fprintf(stdout, "%s",_("Key not found in file\n"));
    421421                  goto findKey;
    422422                }
  • trunk/src/sh_forward.c

    r178 r210  
    18831883        _exit(EXIT_SUCCESS);
    18841884      }
    1885     fprintf(stdout, _("ERROR initializing BigNum library.\n"));
     1885    fprintf(stdout, "%s",_("ERROR initializing BigNum library.\n"));
    18861886    fflush (stdout);
    18871887    _exit(EXIT_FAILURE);
  • trunk/src/sh_getopt.c

    r183 r210  
    321321#ifndef DEFAULT_CONSOLE
    322322  if (num > 0) fputc ('\n', stdout);
    323   printf (_(" console (/dev/console)")); ++num;
     323  printf ("%s", _(" console (/dev/console)")); ++num;
    324324#else
    325325  if (num > 0) fputc ('\n', stdout);
    326326  if (0 == strcmp (DEFAULT_CONSOLE, _("NULL")))
    327     { printf (_("console (/dev/console)"));  ++num; }
     327    { printf ("%s", _("console (/dev/console)"));  ++num; }
    328328  else
    329329    { printf (_("console (%s)"), DEFAULT_CONSOLE);  ++num; }
     
    406406#if defined(USE_SYSTEM_MALLOC)
    407407  if (num > 0) fputc ('\n', stdout);
    408   printf (_(" using system malloc")); ++num;
     408  fputs (_(" using system malloc"), stdout); ++num;
    409409#else
    410410  if (num > 0) fputc ('\n', stdout);
    411   printf (_(" using dnmalloc")); ++num;
     411  fputs (_(" using dnmalloc"), stdout); ++num;
    412412#endif
    413413
     
    554554             "(c) 1999-2008 Rainer Wichmann (http://la-samhna.de).\n"),
    555555           VERSION);
    556   fprintf (stdout, _("This software comes with ABSOLUTELY NO WARRANTY. "));
    557   fprintf (stdout, _("Use at own risk.\n\n"));
     556  fprintf (stdout, "%s",_("This software comes with ABSOLUTELY NO WARRANTY. "));
     557  fprintf (stdout, "%s",_("Use at own risk.\n\n"));
    558558
    559559  sh_getopt_print_log_facilities ();
     
    567567static int sh_getopt_copyright (const char * dummy)
    568568{
    569   fprintf (stdout,
     569  fprintf (stdout, "%s",
    570570           _("Copyright (C) 1999-2008 Rainer Wichmann"\
    571571             " (http://la-samhna.de).\n\n"));
    572572
    573   fprintf (stdout,
     573  fprintf (stdout, "%s",
    574574           _("This program is free software; "\
    575575             "you can redistribute it and/or modify\n"));
    576   fprintf (stdout, _("it under the terms of the GNU General "\
     576  fprintf (stdout, "%s",_("it under the terms of the GNU General "\
    577577                     "Public License as published by\n"));
    578   fprintf (stdout, _("the Free Software Foundation; either version 2 "\
     578  fprintf (stdout, "%s",_("the Free Software Foundation; either version 2 "\
    579579                     "of the License, or\n"));
    580   fprintf (stdout, _("(at your option) any later version.\n\n"));
    581 
    582   fprintf (stdout, _("This program is distributed in the hope "\
     580  fprintf (stdout, "%s",_("(at your option) any later version.\n\n"));
     581
     582  fprintf (stdout, "%s",_("This program is distributed in the hope "\
    583583                     "that it will be useful,\n"));
    584   fprintf (stdout, _("but WITHOUT ANY WARRANTY; "\
     584  fprintf (stdout, "%s",_("but WITHOUT ANY WARRANTY; "\
    585585                     "without even the implied warranty of\n"));
    586   fprintf (stdout, _("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."\
    587                      " See the\n"));
    588   fprintf (stdout, _("GNU General Public License for more details.\n\n"));
    589 
    590   fprintf (stdout, _("You should have received a copy of the "\
     586  fprintf (stdout, "%s",_("MERCHANTABILITY or FITNESS FOR A PARTICULAR "\
     587                     "PURPOSE. See the\n"));
     588  fprintf (stdout, "%s",_("GNU General Public License for more details.\n\n"));
     589
     590  fprintf (stdout, "%s",_("You should have received a copy of the "\
    591591                     "GNU General Public License\n"));
    592   fprintf (stdout, _("along with this program; "\
     592  fprintf (stdout, "%s",_("along with this program; "\
    593593                     "if not, write to the Free Software\n"));
    594   fprintf (stdout, _("Foundation, Inc., 59 Temple Place - Suite 330, "\
     594  fprintf (stdout, "%s",_("Foundation, Inc., 59 Temple Place - Suite 330, "\
    595595                     "Boston, MA  02111-1307, USA.\n\n"));
    596596
    597   fprintf (stdout, _("This product makes use of the reference implementation "\
    598                      "of the TIGER message\n"));
    599   fprintf (stdout, _("digest algorithm. This code is copyright Eli Biham "\
     597  fprintf (stdout, "%s",_("This product makes use of the reference "\
     598                     "implementation of the TIGER message\n"));
     599  fprintf (stdout, "%s",_("digest algorithm. This code is copyright Eli Biham "\
    600600                     "(biham@cs.technion.ac.il)\n"));
    601   fprintf (stdout, _("and Ross Anderson (rja14@cl.cam.ac.uk). It can be used "\
     601  fprintf (stdout, "%s",_("and Ross Anderson (rja14@cl.cam.ac.uk). It can be used "\
    602602                     "freely without any\n"));
    603   fprintf (stdout, _("restrictions.\n"));
     603  fprintf (stdout, "%s",_("restrictions.\n"));
    604604#if defined(USE_SRP_PROTOCOL) && !defined(SH_STANDALONE)
    605605#if (!defined(HAVE_LIBGMP) || !defined(HAVE_GMP_H))
    606   fprintf (stdout, _("This product makes use of the 'bignum' library by "\
     606  fprintf (stdout, "%s",_("This product makes use of the 'bignum' library by "\
    607607                     "Henrik Johansson\n"));
    608   fprintf (stdout, _("(Henrik.Johansson@Nexus.Comm.SE). If you are including "\
    609                      "this library in a\n"));
    610   fprintf (stdout, _("commercial product, be sure to distribute ALL of"\
     608  fprintf (stdout, "%s",_("(Henrik.Johansson@Nexus.Comm.SE). If you are "\
     609                     "including this library in a\n"));
     610  fprintf (stdout, "%s",_("commercial product, be sure to distribute ALL of"\
    611611                     " it with the product.\n"));
    612612#endif
    613   fprintf (stdout, _("This product uses the 'Secure Remote Password' "\
     613  fprintf (stdout, "%s",_("This product uses the 'Secure Remote Password' "\
    614614                     "cryptographic\n"));
    615   fprintf (stdout, _("authentication system developed by Tom Wu "\
     615  fprintf (stdout, "%s",_("authentication system developed by Tom Wu "\
    616616                     "(tjw@CS.Stanford.EDU).\n"));
    617617#endif
    618   fprintf (stdout, _("\nPlease refer to the file COPYING in the source "\
     618  fprintf (stdout, "%s",_("\nPlease refer to the file COPYING in the source "\
    619619                     "distribution for a"));
    620   fprintf (stdout, _("\nfull list of incorporated code and associated "\
     620  fprintf (stdout, "%s",_("\nfull list of incorporated code and associated "\
    621621                     "licenses.\n"));
    622622
     
    644644             "(c) 1999-2006 Rainer Wichmann (http://la-samhna.de).\n"),
    645645           VERSION);
    646   fprintf (stdout, _("This software comes with ABSOLUTELY NO WARRANTY. "));
    647   fprintf (stdout, _("Use at own risk.\n"));
    648 
    649   fprintf (stdout, _("Usage:\n\n"));
     646  fprintf (stdout, "%s",_("This software comes with ABSOLUTELY NO WARRANTY. "));
     647  fprintf (stdout, "%s",_("Use at own risk.\n"));
     648
     649  fprintf (stdout, "%s",_("Usage:\n\n"));
    650650
    651651  for (i = 0; op_table[i].longopt != NULL; ++i) {
     
    656656    if (op_table[i].shortopt != '-' &&
    657657        strchr(opts, op_table[i].shortopt) != NULL)
    658       fprintf (stdout, _("Short option char collision !\n"));
     658      fprintf (stdout, "%s",_("Short option char collision !\n"));
    659659    opts[i] = op_table[i].shortopt;
    660660
     
    689689  }
    690690
    691   fprintf (stdout,
     691  fprintf (stdout, "%s",
    692692           _("\nPlease report bugs to support@la-samhna.de.\n"));
    693693
     
    767767                              /* not last option
    768768                               */
    769                               fprintf (stderr,
     769                              fprintf (stderr, "%s",
    770770                                       _("Error: short option with argument is not last in option string\n"));
    771771                              (void) sh_getopt_usage(_("fail"));
     
    775775                              /* argument required, but no avail
    776776                               */
    777                               fprintf (stderr, _("Error: missing argument\n"));
     777                              fprintf (stderr, "%s",
     778                                       _("Error: missing argument\n"));
    778779                              (void) sh_getopt_usage(_("fail"));
    779780                            }
     
    813814            {
    814815              /* unrecognized short option */
    815               fprintf (stderr, _("Error: unrecognized short option\n"));
     816              fprintf (stderr, "%s",_("Error: unrecognized short option\n"));
    816817              (void) sh_getopt_usage(_("fail"));
    817818            }
     
    840841                              /* argument required, but no avail
    841842                               */
    842                               fprintf (stderr, _("Error: missing argument\n"));
     843                              fprintf (stderr, "%s",
     844                                       _("Error: missing argument\n"));
    843845                              (void) sh_getopt_usage(_("fail"));
    844846                            }
     
    870872                          else
    871873                            {
    872                               fprintf (stderr, _("Error: invalid argument\n"));
     874                              fprintf (stderr, "%s",
     875                                       _("Error: invalid argument\n"));
    873876                              /* argument required, but no avail */
    874877                              (void) sh_getopt_usage(_("fail"));
     
    899902            {
    900903              /* unrecognized long option */
    901               fprintf (stderr, _("Error: unrecognized long option\n"));
     904              fprintf (stderr, "%s",_("Error: unrecognized long option\n"));
    902905              (void) sh_getopt_usage(_("fail"));
    903906            }
  • trunk/src/sh_hash.c

    r205 r210  
    17781778                  sl_write (pushdata_fd,        "\n", 1);
    17791779                } else {
    1780                   printf (_("\n#Host "));
     1780                  printf ("%s",_("\n#Host "));
    17811781                  printf ("%s", sh.host.name);
    1782                   printf (_(" Version "));
     1782                  printf ("%s",_(" Version "));
    17831783                  printf ("%s", sh_db_version_string);
    1784                   printf (_(" Date "));
     1784                  printf ("%s",_(" Date "));
    17851785                  (void) sh_unix_time(0, timestring, sizeof(timestring));
    17861786                  printf ("%s\n", timestring);
     
    38683868    {
    38693869      if (ListWithDelimiter == S_TRUE)
    3870         printf(_(" no_attr"));
     3870        printf("%s",_(" no_attr"));
    38713871    }
    38723872  putchar('\n');
     
    39613961        res = uncompress(decompressed, &clen, decoded, dlen);
    39623962        if (res == Z_MEM_ERROR)
    3963           { fprintf(stderr, _("Error: Not enough memory\n")); return -1; }
     3963          { fprintf(stderr, "%s",_("Error: Not enough memory\n")); return -1; }
    39643964        if (res == Z_DATA_ERROR)
    3965           { fprintf(stderr, _("Error: Data corrupt or incomplete\n")); return -1; }
     3965          { fprintf(stderr, "%s",_("Error: Data corrupt or incomplete\n")); return -1; }
    39663966      } while (res == Z_BUF_ERROR || clen == clen_o);
    39673967
     
    39733973  (void) linkpath;
    39743974#endif
    3975   fprintf(stderr, _("Error: No data available\n"));
     3975  fprintf(stderr, "%s",_("Error: No data available\n"));
    39763976  return -1;
    39773977}
     
    39913991  if (sl_is_suid())
    39923992    {
    3993       fprintf(stderr, _("ERROR: insufficient privilege\n"));
     3993      fprintf(stderr, "%s",_("ERROR: insufficient privilege\n"));
    39943994      _exit (EXIT_FAILURE);
    39953995      return -1; /* for Mac OSX compiler */
     
    40474047              else
    40484048                {
    4049                   fprintf(stderr, _("File is a link\n"));
     4049                  fprintf(stderr, "%s",_("File is a link\n"));
    40504050                  _exit(EXIT_FAILURE);
    40514051                  return -1;
     
    40684068  if (flag == 0)
    40694069    {
    4070       fprintf(stderr, _("File not found\n"));
     4070      fprintf(stderr, "%s",_("File not found\n"));
    40714071      _exit(EXIT_FAILURE);
    40724072    }
  • trunk/src/sh_mail.c

    r190 r210  
    197197          if (numsig > 0)
    198198            {
    199               fprintf (stderr, _("ERROR (no key -- cannot check)\n"));
     199              fprintf (stderr, "%s",_("ERROR (no key -- cannot check)\n"));
    200200              continue;
    201201            }
     
    211211      else if (numsig == 0)
    212212        {
    213           fprintf (stderr, _("ERROR (repeated audit trail)\n"));
     213          fprintf (stderr, "%s",_("ERROR (repeated audit trail)\n"));
    214214          continue;
    215215        }
     
    220220          sh_util_encode(key, bufc, 1, 'A');
    221221          (void) sl_strlcpy (mail_trail_ptr->trail_key, key, KEY_LEN+1);
    222           fprintf (stderr, _("(unchecked)\n"));
     222          fprintf (stderr, "%s",_("(unchecked)\n"));
    223223        }
    224224      else
     
    244244                          KEY_LEN) != 0)
    245245            {
    246               fprintf (stderr, _("(FAILED)\n"));
     246              fprintf (stderr, "%s",_("(FAILED)\n"));
    247247            }
    248248          else
    249249            {
    250               fprintf (stderr, _("(passed)\n"));
     250              fprintf (stderr, "%s",_("(passed)\n"));
    251251            }
    252252
  • trunk/src/sh_portcheck.c

    r206 r210  
    129129#include "sh_utils.h"
    130130#include "sh_modules.h"
     131#define SH_NEED_GETHOSTBYXXX
    131132#include "sh_static.h"
    132133#include "sh_pthread.h"
     
    655656  else
    656657    {
    657       snprintf (buf, sizeof(buf), _("unknown"));
     658      snprintf (buf, sizeof(buf), "%s",_("unknown"));
    658659    }
    659660  return buf;
     
    975976int sh_portchk_init (struct mod_type * arg)
    976977{
     978#ifndef HAVE_PTHREAD
     979  (void) arg;
     980#endif
     981
    977982  if (sh_portchk_active == S_FALSE)
    978983    return SH_MOD_FAILED;
  • trunk/src/sh_processcheck.c

    r205 r210  
    13141314int sh_prochk_init (struct mod_type * arg)
    13151315{
     1316#ifndef HAVE_PTHREAD
     1317  (void) arg;
     1318#endif
     1319
    13161320  if (ShProchkActive == S_FALSE)
    13171321    return SH_MOD_FAILED;
  • trunk/src/sh_utils.c

    r185 r210  
    181181          else
    182182            {
    183               fprintf(stderr, _("Please answer y(es) or n(o)\n"));
     183              fprintf(stderr, "%s", _("Please answer y(es) or n(o)\n"));
    184184            }
    185185          /*@-charintliteral@*/
     
    11231123  if (0 != sl_is_suid())
    11241124    {
    1125       fprintf(stderr, _("ERROR: insufficient privilege\n"));
     1125      fprintf(stderr, "%s", _("ERROR: insufficient privilege\n"));
    11261126      _exit (EXIT_FAILURE);
    11271127      /*@notreached@*/
     
    11311131  if (new_in == NULL || new_in[0] == '\0')
    11321132    {
    1133       fprintf(stderr,
     1133      fprintf(stderr, "%s",
    11341134              _("ERROR: no key given\n Argument must be 'key@path'\n"));
    11351135      _exit (EXIT_FAILURE);
     
    11531153  if (j == 0)
    11541154    {
    1155       fprintf(stderr,
     1155      fprintf(stderr, "%s",
    11561156              _("ERROR: no path to executable given\n Argument must be 'key@path'\n"));
    11571157      free(new);
     
    12211221          UINT32 kbuf[KEY_BYT/sizeof(UINT32)];
    12221222
    1223           printf(_("old key found\n"));
     1223          printf("%s", _("old key found\n"));
    12241224          h1 = sh_tiger_hash_uint32 (key, TIGER_DATA,
    12251225                                     (unsigned long)strlen(key),
     
    12371237    }
    12381238
    1239   fprintf(stderr,
     1239  fprintf(stderr, "%s",
    12401240          _("ERROR: old key not found\n"));
    12411241  free(new); free (outpath); free(image);
     
    12461246
    12471247 bail_mem:
    1248   fprintf(stderr,
     1248  fprintf(stderr, "%s",
    12491249          _("ERROR: out of memory\n"));
    12501250  if (new) free(new);
  • trunk/test/testcompile.sh

    r183 r210  
    2020#
    2121
    22 # dnmalloc + flawfinder + (35 * 3)
    23 MAXTEST=107; export MAXTEST
     22# dnmalloc + flawfinder + (36 * 3)
     23MAXTEST=110; export MAXTEST
    2424
    2525run_dnmalloc ()
     
    202202{
    203203        fail=0
     204        #
     205        # Compiler warnings can be OS specific, but at least
     206        # on Linux there should be none
     207        #
     208        isLinux=0
     209        uname -a | grep Linux >/dev/null
     210        if [ $? -eq 0 ]; then
     211            isLinux=1
     212            sed --in-place 's/-Wall/-Wall -Werror/' Makefile
     213        fi
     214        #
    204215        if test x$1 = x0; then
    205216                [ -z "$verbose" ]     ||  log_msg_ok  "configure...  $TEST";
     
    219230                fail=1
    220231        fi
     232        if [ $isLinux -eq 1 ]; then
     233            sed --in-place 's/-Wall -Werror/-Wall/' Makefile
     234        fi
    221235        if [ $fail -eq 1 ]; then
    222236            [ -z "$quiet" ] && log_fail $2 ${MAXTEST} "$TEST";
     
    335349        # test standalone compilation
    336350        #
     351        TEST="${S}standalone w/procchk w/portchk w/static${E}"
     352        #
     353        if test -r "Makefile"; then
     354                $MAKE distclean
     355        fi
     356        #
     357        ${TOP_SRCDIR}/configure --quiet  --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test  --enable-process-check --enable-port-check --enable-static > /dev/null 2>> test_log
     358        #
     359        let "num = num + 1" >/dev/null
     360        testmake $? $num || let "numfail = numfail + 1"  >/dev/null
     361        let "num = num + 1" >/dev/null
     362        run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
     363        let "num = num + 1" >/dev/null
     364        run_uno $? $num || let "numfail = numfail + 1"  >/dev/null
     365
     366        #
     367        # test standalone compilation
     368        #
    337369        TEST="${S}standalone w/procchk w/portchk w/stealth${E}"
    338370        #
Note: See TracChangeset for help on using the changeset viewer.