aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/spamd.xml6
-rw-r--r--packages/spamd_db_ext.php137
-rw-r--r--packages/spamd_outlook.xml50
-rw-r--r--packages/spamd_settings.xml6
-rw-r--r--packages/spamd_whitelist.xml4
5 files changed, 201 insertions, 2 deletions
diff --git a/packages/spamd.xml b/packages/spamd.xml
index 9bceb8fd..504fcb44 100644
--- a/packages/spamd.xml
+++ b/packages/spamd.xml
@@ -32,7 +32,11 @@
<tab>
<text>SpamD Database</text>
<url>/spamd_db.php</url>
- </tab>
+ </tab>
+ <tab>
+ <text>SpamD Outlook</text>
+ <url>/pkg_edit.php?xml=spamd_outlook.xml&amp;id=0</url>
+ </tab>
</tabs>
<additional_files_needed>
<prefix>/usr/local/www/</prefix>
diff --git a/packages/spamd_db_ext.php b/packages/spamd_db_ext.php
new file mode 100644
index 00000000..f94fc5b2
--- /dev/null
+++ b/packages/spamd_db_ext.php
@@ -0,0 +1,137 @@
+<?php
+/* $Id$ */
+/*
+ spamd_db_ext.php
+ Copyright (C) 2006 Scott Ullrich
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+*/
+
+require("config.inc");
+
+if($_GET['username'])
+ $username = $_GET['username'];
+if($_GET['password'])
+ $password = $_GET['password'];
+if($_POST['username'])
+ $username = $_POST['username'];
+if($_POST['password'])
+ $password = $_POST['password'];
+
+foreach($config['installedpackages']['spamdoutlook']['config'] as $outlook) {
+ if($outlook['username'] <> $username) {
+ echo "550. INVALID USERNAME {$username}.";
+ exit;
+ }
+ if($outlook['password'] <> $password) {
+ echo "550. INVALID PASSWORD {$password}.";
+ exit;
+ }
+}
+
+/* handle AJAX operations */
+if($_GET['action'] or $_POST['action']) {
+ /* echo back buttonid so it can be turned
+ * back off when request is completed.
+ */
+ echo $_GET['buttonid'] . "|";
+ if($_GET['action'])
+ $action = $_GET['action'];
+ if($_POST['action'])
+ $action = $_POST['action'];
+ if($_GET['srcip'])
+ $srcip = $_GET['srcip'];
+ if($_POST['srcip'])
+ $srcip = $_POST['srcip'];
+ /* execute spamdb command */
+ if($action == "whitelist") {
+ exec("/usr/local/sbin/spamdb -a {$srcip}");
+ } else if($action == "delete") {
+ exec("/usr/local/sbin/spamdb -d {$srcip}");
+ exec("/usr/local/sbin/spamdb -d -T \"<{$srcip}>\"");
+ exec("/usr/local/sbin/spamdb -d -t \"<{$srcip}>\"");
+ } else if($action == "spamtrap") {
+ exec("/usr/local/sbin/spamdb -a {$srcip} -T");
+ } else if($action == "trapped") {
+ exec("/usr/local/sbin/spamdb -a {$srcip} -t");
+ }
+ /* signal a reload for real time effect. */
+ mwexec("killall -HUP spamlogd");
+ exit;
+}
+
+/* spam trap e-mail address */
+if($_POST['spamtrapemail'] <> "") {
+ mwexec("/usr/local/sbin/spamdb -T -a \"<{$_POST['spamtrapemail']}>\"");
+ mwexec("killall -HUP spamlogd");
+ $savemsg = $_POST['spamtrapemail'] . " added to spam trap database.";
+}
+
+if($_GET['getstatus'] <> "") {
+ $status = exec("/usr/local/sbin/spamdb | grep \"{$_GET['getstatus']}\"");
+ if(stristr($status, "WHITE") == true) {
+ echo "WHITE";
+ } else if(stristr($status, "TRAPPED") == true) {
+ echo "TRAPPED";
+ } else if(stristr($status, "GREY") == true) {
+ echo "GREY";
+ } else if(stristr($status, "SPAMTRAP") == true) {
+ echo "SPAMTRAP";
+ } else {
+ echo "NOT FOUND";
+ }
+ exit;
+}
+
+/* spam trap e-mail address */
+if($_GET['spamtrapemail'] <> "") {
+ $status = exec("spamdb -T -a \"<{$_GET['spamtrapemail']}>\"");
+ mwexec("killall -HUP spamlogd");
+ if($status)
+ echo $status;
+ else
+ echo $_POST['spamtrapemail'] . " added to spam trap database.";
+ exit;
+}
+
+/* spam trap e-mail address */
+if($_GET['whitelist'] <> "") {
+ $status = exec("spamdb -a \"<{$_GET['spamtrapemail']}>\"");
+ mwexec("killall -HUP spamlogd");
+ if($status)
+ echo $status;
+ else
+ echo $_POST['spamtrapemail'] . " added to whitelist database.";
+ exit;
+}
+
+function basic_auth_prompt(){
+ header("WWW-Authenticate: Basic realm=\".\"");
+ header("HTTP/1.0 401 Unauthorized");
+ echo "You must enter valid credentials to access this resource.";
+ exit;
+}
+
+exit;
+
+?> \ No newline at end of file
diff --git a/packages/spamd_outlook.xml b/packages/spamd_outlook.xml
new file mode 100644
index 00000000..a31345e5
--- /dev/null
+++ b/packages/spamd_outlook.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<packagegui>
+ <name>spamdoutlook</name>
+ <version>0.1.0</version>
+ <title>SpamD Outlook</title>
+ <aftersaveredirect>pkg_edit.php?xml=spamd_outlook.xml&amp;id=0</aftersaveredirect>
+ <tabs>
+ <tab>
+ <text>SpamD External Sources</text>
+ <url>/pkg.php?xml=spamd.xml</url>
+ </tab>
+ <tab>
+ <text>SpamD Whitelist</text>
+ <url>/pkg.php?xml=spamd_whitelist.xml</url>
+ </tab>
+ <tab>
+ <text>SpamD Settings</text>
+ <url>/pkg_edit.php?xml=spamd_settings.xml&amp;id=0</url>
+ </tab>
+ <tab>
+ <text>SpamD Database</text>
+ <url>/spamd_db.php</url>
+ </tab>
+ <tab>
+ <text>SpamD Outlook</text>
+ <url>/pkg_edit.php?xml=spamd_outlook.xml&amp;id=0</url>
+ <active/>
+ </tab>
+ </tabs>
+ <!-- configpath gets expanded out automatically and config items will be
+ stored in that location -->
+ <configpath>['installedpackages']['spamd']['config']</configpath>
+ <!-- fields gets invoked when the user adds or edits a item. the following items
+ will be parsed and rendered for the user as a gui with input, and selectboxes. -->
+ <fields>
+ <field>
+ <fielddescr>Username</fielddescr>
+ <fieldname>username</fieldname>
+ <description>Enter the username the outlook clients will use to connect with.</description>
+ <type>input</type>
+ </field>
+ <field>
+ <fielddescr>Password</fielddescr>
+ <fieldname>password</fieldname>
+ <description>Enter the password the outlook clients will use to connect with.</description>
+ <type>password</type>
+ </field>
+
+ </fields>
+</packagegui> \ No newline at end of file
diff --git a/packages/spamd_settings.xml b/packages/spamd_settings.xml
index 46a3b35c..2bdfaa43 100644
--- a/packages/spamd_settings.xml
+++ b/packages/spamd_settings.xml
@@ -32,7 +32,11 @@
<tab>
<text>SpamD Database</text>
<url>/spamd_db.php</url>
- </tab>
+ </tab>
+ <tab>
+ <text>SpamD Outlook</text>
+ <url>/pkg_edit.php?xml=spamd_outlook.xml&amp;id=0</url>
+ </tab>
</tabs>
<!-- configpath gets expanded out automatically and config items will be
stored in that location -->
diff --git a/packages/spamd_whitelist.xml b/packages/spamd_whitelist.xml
index 366e2338..67b5e233 100644
--- a/packages/spamd_whitelist.xml
+++ b/packages/spamd_whitelist.xml
@@ -28,6 +28,10 @@
<text>SpamD Database</text>
<url>/spamd_db.php</url>
</tab>
+ <tab>
+ <text>SpamD Outlook</text>
+ <url>/pkg_edit.php?xml=spamd_outlook.xml&amp;id=0</url>
+ </tab>
</tabs>
<!-- configpath gets expanded out automatically and config items will be
stored in that location -->