Gordon,

It's never making it to the accept() statement. its hanging immediately on the select() statement.

also, when it's shutting down i see the rest of my debugging statements.

here is a snippet of my code...and logs...

from /var/log/maillog
Aug 14 09:44:50 ns courierfilter: Starting safilter
Aug 14 09:44:50 ns courierfilter: Starting up Spam Filter...
Aug 14 09:44:50 ns courierfilter: argc = 1
Aug 14 09:44:50 ns courierfilter: lf_init() successful
Aug 14 09:44:50 ns courierfilter: value of fd 1 is 1
Aug 14 09:44:50 ns courierfilter: about to select.
Aug 14 09:45:04 ns courieresmtpd: started,ip=[::ffff:24.131.137.108]
Aug 14 09:45:13 ns courieresmtpd: started,ip=[::ffff:65.33.248.197]

From my_lf_select() function
..
static int my_lf_accept(int listensock) {
 /*
 ** copied from courier/filters/libfilter/libfilter.c
 ** changed: different return code for shutting down (0 instead of -1)
 */
 struct sockaddr_un ssun;
 fd_set fd0;
 int fd;
 int sunlen;

 for (;;) {
   FD_ZERO(&fd0);
   FD_SET(0, &fd0);
   FD_SET(listensock, &fd0);

fprintf(stderr, "about to select.\n");
   if (select(listensock+1, &fd0, 0, 0, 0) < 0) {
fprintf(stderr, "bad select.\n");
     return -1;
   }

fprintf(stderr, "Select done...\n");
...
...

From main()

int main(int argc, char *argv[]) {
 int rtc = setpgrp(), wait_child = 5;

fprintf(stderr, "Starting up Spam Filter...\n");

 if (rtc)
   fprintf(stderr, "cannot set process group\n");
 else {
   struct sigaction act;
   memset(&act, 0, sizeof act);
   sigemptyset(&act.sa_mask);

   act.sa_flags = SA_NOCLDSTOP;
   act.sa_handler = child_reaper;
   sigaction(SIGCHLD, &act, NULL);

   act.sa_flags = 0;
   act.sa_handler = sig_catcher;
   sigaction(SIGALRM, &act, NULL);
   sigaction(SIGPIPE, &act, NULL);
   sigaction(SIGINT, &act, NULL);
   sigaction(SIGTERM, &act, NULL);
   sigaction(SIGHUP, &act, NULL);
 }

fprintf(stderr, "argc = %d\n", argc);

 if (argc > 1 && strcmp(argv[1], "-t") == 0 && rtc == 0) {
   int mypipe[2], i;
   if (pipe(mypipe) == 0) {
     FILE *fp = fdopen(mypipe[1], "w");
     for (i = 2; i < argc; ++i) {
       runchild(mypipe[0], 1);
#if !defined(NDEBUG)
       fprintf(stderr, "--------- Running %d children from %d\n",
               live_children, (int)getpid());
#endif
       fprintf(fp, "%s\nthe ids\n\n", argv[i]);
       fflush(fp);
     }
     fclose(fp);
     close(mypipe[0]);
     sleep(1);
   }
   else {
     fprintf(stderr, "Could not open Pipe\n");
     perror("cannot pipe");
  }
 } else if (rtc == 0) { /* install filter */


int listensock = lf_init("filters/safilter-mode", ALLFILTERSOCKETDIR "/safilter", ALLFILTERSOCKETDIR "/.safilter", FILTERSOCKETDIR "/safilter", FILTERSOCKETDIR "/.safilter");

   if (listensock < 0) {
     perror("safilter: lf_init failed");
     return 1;
   }

fprintf(stderr, "lf_init() successful\n");

lf_init_completed(listensock);

   for (;;) {
     int fd;

     if (signal_hangup) {
       signal_hangup = 0;
     }

fprintf(stderr, "value of fd 1 is %d\n");

     if ((fd = my_lf_accept(listensock)) <= 0) {
fprintf(stderr, "value of fd 2 is %d\n");
       if (fd < 0) { /* select interrupted */
fprintf(stderr, "value of fd 3 is %d\n");


here is what it shows when i shut down safilter... using filterctl stop safilter
Aug 14 09:44:31 ns courierfilter: Stopping safilter
Aug 14 09:44:31 ns courierfilter: Select done...
Aug 14 09:44:31 ns courierfilter: read on socket <= 0, bailing
Aug 14 09:44:31 ns courierfilter: value of fd 2 is 1
Aug 14 09:44:31 ns courierfilter: safilter: exiting


end snippets------------>


Gordon Messmer wrote:


Bill Long wrote:

Basically, the symptoms are that the filters are starting up, but it seems that courier never hands off any messages to them via the submit function.


What do you get from:
# find /var/spool/courier/allfilters/ /var/spool/courier/filters/

How do you know that courier isn't handing it messages? Does the filter log anything after it accept()s the connection? If not, try putting in a debug statement that writes a message to stdout immediately after the connection is accepted, or before it's accepted if you're using select/accept in concert.



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01


_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users






-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to