Changeset 550 for trunk/src


Ignore:
Timestamp:
Oct 31, 2019, 9:13:12 PM (5 years ago)
Author:
katerina
Message:

Fix for ticket #442 (support for OpenBSD signify).

Location:
trunk/src
Files:
1 added
1 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/depend-gen.c

    r383 r550  
    245245           *
    246246           **************************************************/
    247           if (0 == strcmp(p, "sh_gpg_chksum.h") ||
     247          if (0 == strcmp(p, "sh_sig_chksum.h") ||
    248248              0 == strcmp(p, "sh_gpg_fp.h"))
    249249            {
  • trunk/src/samhain.c

    r541 r550  
    7777
    7878#include "sh_tiger.h"
    79 #include "sh_gpg.h"
     79#include "sh_sig.h"
    8080#include "sh_mem.h"
    8181#include "sh_xfer.h"
     
    19071907#if defined(SH_WITH_SERVER) && !defined(SH_WITH_CLIENT)
    19081908
    1909 #if (defined(WITH_GPG) || defined(WITH_PGP))
     1909#if defined(WITH_GPG)
    19101910  /* log startup */
    1911   sh_gpg_log_startup ();
     1911  sh_sig_log_startup ();
    19121912#else
    19131913  sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_START_1H,
     
    19301930  if (sh.flag.checkSum == SH_CHECK_CHECK)
    19311931    {
    1932 #if (defined(WITH_GPG) || defined(WITH_PGP))
     1932#if defined(WITH_GPG)
    19331933      /* log startup */
    1934       sh_gpg_log_startup ();
     1934      sh_sig_log_startup ();
    19351935#else
    19361936      sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_START_2H,
     
    19421942  else
    19431943    {
    1944 #if (defined(WITH_GPG) || defined(WITH_PGP))
     1944#if defined(WITH_GPG)
    19451945      /* log startup */
    1946       sh_gpg_log_startup ();
     1946      sh_sig_log_startup ();
    19471947#else
    19481948      sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_START_1H,
  • trunk/src/sh_calls.c

    r544 r550  
    533533
    534534long int retry_aud_execve  (const char * file, int line,
    535                             const  char *dateiname, char * argv[],
    536                             char * envp[])
     535                            const  char *dateiname, char *const argv[],
     536                            char *const envp[])
    537537{
    538538  uid_t a = geteuid();
  • trunk/src/sh_dbIO.c

    r543 r550  
    3131#include "sh_hash.h"
    3232#include "sh_dbIO.h"
    33 #include "sh_gpg.h"
     33#include "sh_sig.h"
    3434#include "sh_tiger.h"
    3535#include "sh_xfer.h"
     
    852852static SL_TICKET verify_data (SL_TICKET fd)
    853853{
    854 #if defined(WITH_GPG) || defined(WITH_PGP)
     854#if defined(WITH_SIG)
    855855  SL_TICKET fdTmp;
    856856
    857857  /* extract the data and copy to temporary file
    858858   */
    859   fdTmp = sh_gpg_extract_signed(fd);
     859  fdTmp = sh_sig_extract_signed(fd);
    860860
    861861  if (sig_termfast == 1)  /* SIGTERM */
     
    871871  /* Validate signature of open file.
    872872   */
    873   if (0 != sh_gpg_check_sign (fd, SIG_DATA))
     873  if (0 != sh_sig_check_signature (fd, SIG_DATA))
    874874    {
    875875      sl_close(fd);
     
    877877    }
    878878  sl_rewind (fd);
     879
     880  fdTmp = sh_sig_extract_signed_data(fd);
     881  sl_close(fd);
     882  fd = fdTmp; 
    879883#endif
    880884
  • trunk/src/sh_getopt.c

    r543 r550  
    481481#ifdef WITH_GPG
    482482  if (num > 0) fputc ('\n', stdout);
    483   printf (_(" GnuPG signatures (%s)"), DEFAULT_GPG_PATH); ++num;
    484 #ifdef HAVE_GPG_CHECKSUM
    485   if (num > 0) fputc ('\n', stdout);
    486   printf (_("   -- GnuPG checksum:  %s"), GPG_HASH); ++num;
     483  printf (_(" GnuPG signatures (%s)"), DEFAULT_SIG_PATH); ++num;
     484#ifdef HAVE_SIG_CHECKSUM
     485  if (num > 0) fputc ('\n', stdout);
     486  printf (_("   -- GnuPG checksum:  %s"), SIG_HASH); ++num;
    487487#endif
    488488#ifdef USE_FINGERPRINT
  • trunk/src/sh_hash.c

    r534 r550  
    5454#include "sh_error.h"
    5555#include "sh_tiger.h"
    56 #include "sh_gpg.h"
     56#include "sh_sig.h"
    5757#include "sh_unix.h"
    5858#include "sh_files.h"
  • trunk/src/sh_readconf.c

    r514 r550  
    3434#include "sh_files.h"
    3535#include "sh_xfer.h"
    36 #include "sh_gpg.h"
     36#include "sh_sig.h"
    3737#include "sh_hash.h"
    3838#include "sh_dbIO.h"
     
    352352  SL_TICKET    fdTmp = -1;
    353353#endif
    354 #if defined(WITH_GPG) || defined(WITH_PGP)
    355   SL_TICKET    fdGpg = -1;
     354#if defined(WITH_SIG)
     355  SL_TICKET    fdSIG = -1;
    356356#endif
    357357  char * tmp;
     
    369369  char   local_flag = 'R';
    370370
    371 #if defined(WITH_GPG) || defined(WITH_PGP)
     371#if defined(WITH_SIG)
    372372  int    signed_content = S_FALSE;
    373373  int    true_content   = S_FALSE;
     
    470470        sl_write_line(fdTmp, line_in, sl_strlen(line_in));
    471471      }
    472 #if defined(WITH_GPG) || defined(WITH_PGP)
    473     if (0 == sl_strncmp(line_in, _("-----END PGP SIGNATURE-----"), 25))
     472#if defined(WITH_SIG)
     473    if (S_TRUE == sh_sig_data_end(line_in))
    474474      break;
    475475#else
     
    485485#endif
    486486
    487 #if defined(WITH_GPG) || defined(WITH_PGP)
     487#if defined(WITH_SIG)
    488488
    489489  /* extract the data and copy to temporary file
    490490   */
    491   fdGpg = sh_gpg_extract_signed(fd);
     491  fdSIG = sh_sig_extract_signed(fd);
    492492
    493493  sl_close(fd);
    494   fd = fdGpg;
     494  fd = fdSIG;
    495495
    496496  /* Validate signature of open file.
    497497   */
    498   if (0 != sh_gpg_check_sign (fd, SIG_CONF))
     498  if (0 != sh_sig_check_signature (fd, SIG_CONF))
    499499    {
    500500      SH_FREE(line_in);
     
    520520    /* Sun May 27 18:40:05 CEST 2001
    521521     */
    522 #if defined(WITH_GPG) || defined(WITH_PGP)
     522#if defined(WITH_SIG)
    523523    if (signed_content == S_FALSE)
    524524      {
    525         if (0 == sl_strcmp(line, _("-----BEGIN PGP SIGNED MESSAGE-----")))
     525        if (S_TRUE == sh_sig_msg_start(line))
    526526          signed_content = S_TRUE;
    527527        else
    528528          continue;
    529529      }
    530     else if (true_content == S_FALSE)
    531       {
    532         if (line[0] == '\n')
    533           true_content = S_TRUE;
    534         else
    535           continue;
    536       }
    537     else if (signed_content == S_TRUE)
     530    else /* if (signed_content == S_TRUE) */
    538531      {
    539         if (0 == sl_strcmp(line, _("-----BEGIN PGP SIGNATURE-----")))
     532        if (S_TRUE == sh_sig_msg_end(line))
    540533          break;
    541         else if (0 == sl_strcmp(line, _("-----BEGIN PGP SIGNED MESSAGE-----")))
     534        else if (S_TRUE == sh_sig_msg_start(line))
    542535          {
    543536            sh_error_handle((-1), FIL__, __LINE__, 0, MSG_E_SUBGEN,
     
    551544            aud_exit (FIL__, __LINE__,EXIT_FAILURE);
    552545          }
     546      }
     547
     548    if (true_content == S_FALSE) /* continue if in header */
     549      {
     550        if (S_TRUE == sh_sig_msg_startdata(line))
     551          true_content = S_TRUE;
     552        else
     553          continue;
    553554      }
    554555#endif
  • trunk/src/sh_tools.c

    r541 r550  
    20752075#endif
    20762076
    2077 #if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER) || defined(SH_STEALTH) || defined(WITH_GPG) || defined(WITH_PGP)
     2077#if defined(SH_WITH_CLIENT) || defined(SH_WITH_SERVER) || defined(SH_STEALTH) || defined(WITH_SIG)
    20782078
    20792079/* --------- secure temporary file ------------ */
  • trunk/src/sh_unix.c

    r541 r550  
    54075407{
    54085408  int                  add_off = 0, llen;
     5409  unsigned long        bread;
    54095410  static unsigned long off_data   = 0;
    54105411  static unsigned long max_data   = 0;
     
    54545455  /* --- Read one line. ---
    54555456   */
    5456   add_off   = hideout_hex_block(fd, (unsigned char *) str, len, &bytes_read);
    5457   off_data += add_off;
     5457  add_off   = hideout_hex_block(fd, (unsigned char *) str, len, &bread);
     5458  if (add_off > 0)
     5459    off_data += add_off;
     5460  bytes_read += bread;
     5461
     5462  if (bread == 0 || add_off <= 0) /* EOF */
     5463    str[0] = '\0';
    54585464
    54595465  llen = sl_strlen(str);
     
    54775483  ASSERT_RET((len > 1), _("len > 1"), (0));
    54785484
     5485  str[0] = '\0';
     5486  *bytes_read = 0;
    54795487  --len;
    54805488
     
    54945502              do {
    54955503                do {
     5504                  errno = 0;
    54965505                  num = sl_read (fd, &c, 1);
    54975506                } while (num == 0 && errno == EINTR);
    54985507                if (num > 0)
    54995508                  ++here;
    5500                 else if (num == 0)
    5501                   SL_RETURN((0), _("hideout_hex_block"));
    5502                 else
     5509                else if (num == 0) {
    55035510                  SL_RETURN((-1), _("hideout_hex_block"));
     5511                }
     5512                else {
     5513                  SL_RETURN((-1), _("hideout_hex_block"));
     5514                }
    55045515              } while (c == '\n' || c == '\t' || c == '\r' ||
    55055516                       c == ' ');
     
    55235534  if (i != 0)
    55245535    str[i] = '\0';
     5536  else if (str[0] == '\n')
     5537    str[i+1] = '\0'; /* keep newline and terminate */
    55255538  else
    5526     str[i+1] = '\0'; /* keep newline and terminate */
     5539    str[0] = '\0';
    55275540  retval += here;
    55285541  *bytes_read += (bread/8);
Note: See TracChangeset for help on using the changeset viewer.