/* -*-c-*-
*
- * $Id: qmail-checkspam.c,v 1.1 2003/10/01 00:08:57 mdw Exp $
+ * $Id: qmail-checkspam.c,v 1.2 2004/04/08 01:36:26 mdw Exp $
*
* Filter messages for spam
*
* (c) 2003 Mark Wooding
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-/*----- Revision history --------------------------------------------------*
- *
- * $Log: qmail-checkspam.c,v $
- * Revision 1.1 2003/10/01 00:08:57 mdw
- * Collection of miscellaneous ill-documented tools.
- *
- */
-
/*----- Header files ------------------------------------------------------*/
#include <ctype.h>
#include <errno.h>
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct message m;
int fd_m[2], fd_e[2];
pid_t kid;
+ const char *qmq;
int rc;
+ if (getenv("RELAYCLIENT")) goto exec;
m.max_len = intenv("QMAIL_CHECKSPAM_MAXLEN", 2 * 1024 * 1024);
m.timeout = intenv("QMAIL_CHECKSPAM_TIMEOUT", 300);
rc = message_read(0, 0, &m);
close(fd_e[0]);
close(fd_m[1]);
close(fd_e[1]);
- execlp(strenv("QMAIL_CHECKSPAM_QUEUE", "/var/qmail/bin/qmail-queue"),
- (char *)0);
+exec:
+ qmq = strenv("QMAIL_CHECKSPAM_QUEUE", "/var/qmail/bin/qmail-queue");
+ execlp(qmq, qmq, (char *)0);
fprintf(stderr, "failed to exec: %s\n", strerror(errno));
return (56);
}