/*
- * $Id$
- *
* This module allows Citadel to use SpamAssassin to filter incoming messages
* arriving via SMTP. For more information on SpamAssassin, visit
* http://www.spamassassin.org (the SpamAssassin project is not in any way
*
* Copyright (c) 1998-2009 by the citadel.org team
*
- * 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 3 of the License, or
- * (at your option) any later version.
+ * 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 3 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.
+ * 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
+ * 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
*/
#define SPAMASSASSIN_PORT "783"
#include "config.h"
#include "control.h"
#include "user_ops.h"
-#include "policy.h"
#include "database.h"
#include "msgbase.h"
#include "internet_addressing.h"
char buf[SIZ];
int is_spam = 0;
int sa;
- char *msgtext;
- size_t msglen;
+ StrBuf *msgtext;
CitContext *CCC=CC;
/* For users who have authenticated to this server we never want to
for (sa=0; sa<num_sahosts; ++sa) {
extract_token(buf, sahosts, sa, '|', sizeof buf);
CtdlLogPrintf(CTDL_INFO, "Connecting to SpamAssassin at <%s>\n", buf);
- sock = sock_connect(buf, SPAMASSASSIN_PORT, "tcp");
+ sock = sock_connect(buf, SPAMASSASSIN_PORT);
if (sock >= 0) CtdlLogPrintf(CTDL_DEBUG, "Connected!\n");
}
return(0);
}
- CCC->sReadBuf = NewStrBuf();
+ CCC->SBuf.Buf = NewStrBuf();
CCC->sMigrateBuf = NewStrBuf();
- CCC->sPos = NULL;
+ CCC->SBuf.ReadWritePointer = NULL;
/* Command */
CtdlLogPrintf(CTDL_DEBUG, "Transmitting command\n");
sock_write(&sock, buf, strlen(buf));
/* Message */
- CCC->redirect_buffer = malloc(SIZ);
- CCC->redirect_len = 0;
- CCC->redirect_alloc = SIZ;
+ CCC->redirect_buffer = NewStrBufPlain(NULL, SIZ);
CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_ALL, 0, 1, 0);
msgtext = CC->redirect_buffer;
- msglen = CC->redirect_len;
- CCC->redirect_buffer = NULL;
- CCC->redirect_len = 0;
- CCC->redirect_alloc = 0;
+ CC->redirect_buffer = NULL;
- sock_write(&sock, msgtext, msglen);
- free(msgtext);
+ sock_write(&sock, SKEY(msgtext));
+ FreeStrBuf(&msgtext);
/* Close one end of the socket connection; this tells SpamAssassin
* that we're done.
}
bail: close(sock);
- FreeStrBuf(&CCC->sReadBuf);
+ FreeStrBuf(&CCC->SBuf.Buf);
FreeStrBuf(&CCC->sMigrateBuf);
return(is_spam);
}
}
/* return our Subversion id for the Log */
- return "$Id$";
+ return "spam";
}