Changeset 200


Ignore:
Timestamp:
Nov 27, 2008, 10:26:50 PM (13 years ago)
Author:
katerina
Message:

Implement server->client SCAN command to run file check on demand.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/Changelog

    r196 r200  
    112.5.1:
     2        * implement server->client SCAN command to initiate file check
     3        * implement @if / @else conditionals with more tests in config file
    24        * new option SetDropCache to drop checksummed files from cache
    35        * report process/user for open ports on FreeBSD (code
  • trunk/include/sh_socket.h

    r170 r200  
    2020void   sh_socket_add2reload (const char * clt);
    2121
    22 
    2322#endif
    2423
  • trunk/src/sh_socket.c

    r177 r200  
    5353      SL_RET0(_("sh_socket_server_cmd"));
    5454    }
    55   if ((srvcmd[0] == 'S') || (srvcmd[1] == 'T') ||
    56       (srvcmd[2] == 'O') || (srvcmd[3] == 'P'))
     55  if ((srvcmd[0] == 'S') && (srvcmd[1] == 'T') &&
     56      (srvcmd[2] == 'O') && (srvcmd[3] == 'P'))
    5757    {
    5858      TPT((0, FIL__, __LINE__, _("msg=<stop command from server>\n")));
     
    6060      raise(SIGQUIT);
    6161#else
    62       TPT((0, FIL__, __LINE__, _("msg=<sigquit not defined>\n")));
     62      sig_terminate       = 1;
     63      ++sig_raised;
    6364#endif
    6465    }
    65   else if ((srvcmd[0] == 'R') || (srvcmd[1] == 'E') ||
    66            (srvcmd[2] == 'L') || (srvcmd[3] == 'O') ||
    67            (srvcmd[4] == 'A') || (srvcmd[5] == 'D'))
     66  else if ((srvcmd[0] == 'R') && (srvcmd[1] == 'E') &&
     67           (srvcmd[2] == 'L') && (srvcmd[3] == 'O') &&
     68           (srvcmd[4] == 'A') && (srvcmd[5] == 'D'))
    6869    {
    6970      TPT((0, FIL__, __LINE__, _("msg=<reload command from server>\n")));
     
    7172      raise(SIGHUP);
    7273#else
    73       TPT((0, FIL__, __LINE__, _("msg=<sighup not defined>\n")));
    74 #endif
     74      sig_config_read_again = 1;
     75      ++sig_raised;
     76#endif
     77    }
     78  else if ((srvcmd[0] == 'S') && (srvcmd[1] == 'C') &&
     79           (srvcmd[2] == 'A') && (srvcmd[3] == 'N'))
     80    {
     81      TPT((0, FIL__, __LINE__, _("msg=<scan command from server>\n")));
     82      if (sh.flag.isdaemon == ON)
     83        {
     84#ifdef SIGTTOU
     85          raise(SIGTTOU);
     86#else
     87          sig_force_check = 1;
     88          ++sig_raised;
     89#endif
     90        }
     91      else
     92        {
     93          sig_force_check = 1;
     94          ++sig_raised;
     95        }
    7596    }
    7697  else
  • trunk/src/sh_unix.c

    r199 r200  
    36023602          tmp2 = sh_util_safe_name (theFile->fullpath);
    36033603
    3604           if (fstat_return != 0)
     3604
     3605          if (fd >= 0 && fstat_return != 0)
    36053606            {
    36063607              char errbuf[SH_ERRBUF_SIZE];
     
    36133614                               tmp2);
    36143615            }
    3615           else if (!S_ISREG(fbuf.st_mode))
     3616          else if (fd >= 0 && !S_ISREG(fbuf.st_mode))
    36163617            {
    36173618              sh_error_handle (level, FIL__, __LINE__, fstat_errno,
  • trunk/src/slib.c

    r196 r200  
    26652665    {
    26662666    case SL_EBOGUS:
    2667       return _("Bogus file. Modified during access.");
     2667      return _("Bogus file. Modified during access");
    26682668    case SL_EWRITE:
    2669       return _("Write error.");
     2669      return _("Write error");
    26702670    case SL_EREAD:
    2671       return _("Read error.");
     2671      return _("Read error");
    26722672    case SL_ESYNC:
    2673       return _("Error in fsync().");
     2673      return _("Error in fsync()");
    26742674    case SL_EFORWARD:
    2675       return _("Error in lseek().");
     2675      return _("Error in lseek()");
    26762676    case SL_EREWIND:
    2677       return _("Error in lseek().");
     2677      return _("Error in lseek()");
    26782678    case SL_EUNLINK:
    2679       return _("Error in unlink().");
     2679      return _("Error in unlink()");
    26802680    case SL_EMEM:
    2681       return _("Out of memory.");
     2681      return _("Out of memory");
    26822682    case SL_EINTERNAL:
    2683       return _("Internal error.");
     2683      return _("Internal error");
    26842684    case SL_ETICKET:
    2685       return _("Bad ticket.");
     2685      return _("Bad ticket");
    26862686    case SL_EREPEAT:
    2687       return _("Illegal repeated use of function.");
     2687      return _("Illegal repeated use of function");
    26882688    case SL_ERANGE:
    2689       return _("Argument out of range.");
     2689      return _("Argument out of range");
    26902690    case SL_ENULL:
    2691       return _("Dereferenced NULL pointer.");
     2691      return _("Dereferenced NULL pointer");
    26922692
    26932693    case SL_EBADUID:
    2694       return _("Owner not trustworthy.");
     2694      return _("Owner not trustworthy");
    26952695    case SL_EBADGID:
    2696       return _("Group writeable and member not trustworthy.");
     2696      return _("Group writeable and member not trustworthy");
    26972697    case SL_EBADOTH:
    2698       return _("World writeable.");
     2698      return _("World writeable");
    26992699    case SL_EISDIR:
    2700       return _("Is a directory.");
     2700      return _("Is a directory");
    27012701    case SL_EBADFILE:
    2702       return _("File access error.");
     2702      return _("File access error");
    27032703    case SL_EBADNAME:
    2704       return _("Invalid filename (prob. too long or null).");
     2704      return _("Invalid filename (prob. too long or null)");
    27052705
    27062706    case SL_ETRUNC:
    2707       return _("Truncation occured.");
     2707      return _("Truncation occured");
    27082708    case SL_ESTAT:
    2709       return _("stat() failed.");
     2709      return _("stat() failed");
    27102710    case SL_EFSTAT:
    2711       return _("fstat() failed.");
     2711      return _("fstat() failed");
    27122712    default:
    2713       return _("Unknown error.");
     2713      return _("Unknown error");
    27142714    }
    27152715}
  • trunk/src/yulectl.c

    r117 r200  
    327327  printf(_("Commands: RELOAD    <reload configuration>\n"));
    328328  printf(_("          STOP      <terminate>\n"));
     329  printf(_("          SCAN      <initiate file system check\n"));
    329330  printf(_("          CANCEL    <cancel previous command>\n"));
    330331  printf(_("          LIST      <list queued commands>\n"));
     
    400401  strcat(home, _("/.yulectl_cred"));
    401402  fp = fopen(home, "r");
     403
     404#if !defined(HAVE_GETPEEREID) && !defined(SO_PEERCRED) && !defined(HAVE_STRUCT_CMSGCRED) && !defined(HAVE_STRUCT_FCRED) && !(defined(HAVE_STRUCT_SOCKCRED) && defined(LOCAL_CREDS))
    402405  if (fp == NULL)
    403406    {
    404       if (verbose && (errno == ENOENT))
    405         fprintf (stdout,
    406                  _("# No password file (%s) exists\n"),
     407      if (errno == ENOENT) {
     408        fprintf (stderr,
     409                 _("ERROR No password file (%s) exists\n"),
    407410                 home);
    408       else if (verbose)
    409         fprintf (stdout,
    410                  _("# Password file (%s) not accessible for euid %ld uid %ld\n"),
     411      }
     412      else {
     413        fprintf (stderr,
     414                 _("ERROR: Password file (%s) not accessible for euid %ld uid %ld\n"),
    411415                 home, (long)geteuid(), (long)getuid());
    412       return;
    413     }
     416      }
     417      exit(EXIT_FAILURE);
     418    }
     419#else
     420  if (fp == NULL)
     421    return;
     422#endif
     423
    414424  if (NULL == fgets(message2, sizeof(message2), fp))
    415425    {
Note: See TracChangeset for help on using the changeset viewer.