From 55eddd7accf2c5f9b0f52b22a010c4c4b7c130d1 Mon Sep 17 00:00:00 2001 From: Bill Marquette Date: Fri, 6 Feb 2009 19:18:00 -0600 Subject: mv packages to config dir to match web layout --- packages/dspam/pkg/000.mysql.sh | 68 - packages/dspam/pkg/010.clamav-clamd.sh | 56 - packages/dspam/pkg/020.clamav-freshclam.sh | 33 - packages/dspam/pkg/030.p3scan.sh | 60 - packages/dspam/pkg/clamd.conf | 299 ---- packages/dspam/pkg/default.prefs.sample | 43 - packages/dspam/pkg/dspam-config.inc | 42 - packages/dspam/pkg/dspam-guifunc.inc | 2606 ---------------------------- packages/dspam/pkg/dspam-pkgfunc.inc | 548 ------ packages/dspam/pkg/dspam-utilfunc.inc | 458 ----- packages/dspam/pkg/dspam.inc | 360 ---- packages/dspam/pkg/dspam.xml | 342 ---- packages/dspam/pkg/dspam_alerts.xml | 147 -- packages/dspam/pkg/freshclam.conf | 110 -- packages/dspam/pkg/p3scan-pf-emer.xml | 127 -- packages/dspam/pkg/p3scan-pf-msg.xml | 198 --- packages/dspam/pkg/p3scan-pf-spam.xml | 119 -- packages/dspam/pkg/p3scan-pf-vir.xml | 162 -- packages/dspam/pkg/p3scan-pf.xml | 211 --- packages/dspam/pkg/p3scan.inc | 277 --- packages/dspam/pkg/verdana.ttf | Bin 139640 -> 0 bytes 21 files changed, 6266 deletions(-) delete mode 100644 packages/dspam/pkg/000.mysql.sh delete mode 100644 packages/dspam/pkg/010.clamav-clamd.sh delete mode 100644 packages/dspam/pkg/020.clamav-freshclam.sh delete mode 100644 packages/dspam/pkg/030.p3scan.sh delete mode 100644 packages/dspam/pkg/clamd.conf delete mode 100644 packages/dspam/pkg/default.prefs.sample delete mode 100644 packages/dspam/pkg/dspam-config.inc delete mode 100644 packages/dspam/pkg/dspam-guifunc.inc delete mode 100644 packages/dspam/pkg/dspam-pkgfunc.inc delete mode 100644 packages/dspam/pkg/dspam-utilfunc.inc delete mode 100644 packages/dspam/pkg/dspam.inc delete mode 100644 packages/dspam/pkg/dspam.xml delete mode 100644 packages/dspam/pkg/dspam_alerts.xml delete mode 100644 packages/dspam/pkg/freshclam.conf delete mode 100644 packages/dspam/pkg/p3scan-pf-emer.xml delete mode 100644 packages/dspam/pkg/p3scan-pf-msg.xml delete mode 100644 packages/dspam/pkg/p3scan-pf-spam.xml delete mode 100644 packages/dspam/pkg/p3scan-pf-vir.xml delete mode 100644 packages/dspam/pkg/p3scan-pf.xml delete mode 100644 packages/dspam/pkg/p3scan.inc delete mode 100644 packages/dspam/pkg/verdana.ttf (limited to 'packages/dspam/pkg') diff --git a/packages/dspam/pkg/000.mysql.sh b/packages/dspam/pkg/000.mysql.sh deleted file mode 100644 index 9c25c370..00000000 --- a/packages/dspam/pkg/000.mysql.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh -# This file was automatically generated -# by the pfSense service handler - -rc_start() { -test_mysql_user=`cat /etc/passwd | grep mysql` -test_mysql_group=`cat /etc/group | grep mysql` -mysql_user="mysql" -mysql_limits_args="-e -U ${mysql_user}" -pidfile="/var/db/mysql/`/bin/hostname`.pid" -command="/usr/local/bin/mysqld_safe" -command_args="--user=${mysql_user} --datadir=/var/db/mysql --pid-file=${pidfile} --bind-address=127.0.0.1 --set-variable=max_connections=500" -procname="/usr/local/libexec/mysqld" -mysql_install_db="/usr/local/bin/mysql_install_db" -mysql_install_db_args="--ldata=/var/db/mysql" - -/sbin/mount_fdescfs fdescfs /dev/fd - -if [ -z "${test_mysql_group}" ]; then - pw groupadd mysql -g 88 -fi - -if [ -z "${test_mysql_user}" ]; then - pw useradd mysql -u 88 -g 88 -d /nonexistent -s /sbin/nologin -c 'MySQL Daemon' -fi - -if [ ! -d "/var/db/mysql" ]; then - mkdir /var/db/mysql && chown mysql:mysql /var/db/mysql -fi - -if [ ! -d "/var/db/mysql/mysql/." ]; then - eval $mysql_install_db $mysql_install_db_args >/dev/null - [ $? -eq 0 ] && chown -R ${mysql_user}:${mysql_user} /var/db/mysql -fi - -#if checkyesno mysql_limits; then -# eval `/usr/bin/limits ${mysql_limits_args}` 2>/dev/null -#else -# return 0 -#fi - -${command} ${command_args} > /dev/null & -} - -rc_stop() { -/usr/bin/killall mysqld -sleep 2 -} - -rc_restart() { - rc_stop - rc_start -} - -case $1 in - start) - rc_start - ;; - stop) - rc_stop - ;; - restart) - rc_restart - ;; - *) - echo "Usage: $0 " - ;; -esac diff --git a/packages/dspam/pkg/010.clamav-clamd.sh b/packages/dspam/pkg/010.clamav-clamd.sh deleted file mode 100644 index aeb23b04..00000000 --- a/packages/dspam/pkg/010.clamav-clamd.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -# This file was automatically generated -# by the pfSense service handler - -rc_start() { -test_clamav_group=`cat /etc/group | grep clam` -test_clamav_user=`cat /etc/passwd | grep clam` - -if [ -z "${test_clamav_group}" ]; then - pw groupadd clamav -g 106 -fi - -if [ -z "${test_clamav_user}" ]; then - pw useradd clamav -u 106 -g 106 -d /nonexistent -s /sbin/nologin -c 'Clam Antivirus' -fi - -if [ ! -d "/usr/local/share/clamav" ]; then - mkdir /usr/local/share/clamav && chown clamav:clamav /usr/local/share/clamav -fi - -if [ ! -d "/var/log/clamav" ]; then - mkdir /var/log/clamav && chown clamav:clamav /var/log/clamav -fi - -if [ ! -d "/var/run/clamav" ]; then - mkdir /var/run/clamav && chown clamav:clamav /var/run/clamav -fi - - /sbin/mount_fdescfs fdescfs /dev/fd - /usr/local/sbin/clamd -} - -rc_stop() { - /usr/bin/killall clamd - sleep 2 -} - -rc_restart() { - rc_stop - rc_start -} - -case $1 in - start) - rc_start - ;; - stop) - rc_stop - ;; - restart) - rc_restart - ;; - *) - echo "Usage: $0 " - ;; -esac diff --git a/packages/dspam/pkg/020.clamav-freshclam.sh b/packages/dspam/pkg/020.clamav-freshclam.sh deleted file mode 100644 index 4332d757..00000000 --- a/packages/dspam/pkg/020.clamav-freshclam.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -# This file was automatically generated -# by the pfSense service handler - -rc_start() { - /sbin/mount_fdescfs fdescfs /dev/fd - /usr/local/bin/freshclam --daemon -} - -rc_stop() { - /usr/bin/killall freshclam - sleep 2 -} - -rc_restart() { - rc_stop - rc_start -} - -case $1 in - start) - rc_start - ;; - stop) - rc_stop - ;; - restart) - rc_restart - ;; - *) - echo "Usage: $0 " - ;; -esac diff --git a/packages/dspam/pkg/030.p3scan.sh b/packages/dspam/pkg/030.p3scan.sh deleted file mode 100644 index ffd08abf..00000000 --- a/packages/dspam/pkg/030.p3scan.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh -# This file was automatically generated -# by the pfSense service handler - -rc_start() { -test_p3scan_user=`cat /etc/passwd | grep p3scan` -test_p3scan_group=`cat /etc/passwd | grep p3scan` - -if [ -z "${test_p3scan_group}" ]; then - pw groupadd p3scan -g 108 -fi - -if [ -z "${test_p3scan_user}" ]; then - pw useradd p3scan -u 108 -g p3scan -d /var/spool/p3scan -s /sbin/nologin -c 'P3Scan Daemon' -fi - -if [ ! -d "/var/spool/p3scan" ]; then - mkdir /var/spool/p3scan && chown p3scan:p3scan /var/spool/p3scan -fi - -if [ ! -d "/var/spool/p3scan/children" ]; then - mkdir /var/spool/p3scan/children && chown p3scan:p3scan /var/spool/p3scan/children -fi - -if [ ! -d "/var/spool/p3scannotify" ]; then - mkdir /var/spool/p3scannotify && chown p3scan:p3scan /var/spool/p3scannotify -fi - -if [ ! -d "/var/run/p3scan" ]; then - mkdir /var/run/p3scan && chown p3scan:p3scan /var/run/p3scan -fi - - /sbin/mount_fdescfs fdescfs /dev/fd - /usr/local/sbin/p3scan --configfile=/usr/local/etc/p3scan/p3scan.conf & -} - -rc_stop() { - /usr/bin/killall p3scan - sleep 2 -} - -rc_restart() { - rc_stop - rc_start -} - -case $1 in - start) - rc_start - ;; - stop) - rc_stop - ;; - restart) - rc_restart - ;; - *) - echo "Usage: $0 " - ;; -esac diff --git a/packages/dspam/pkg/clamd.conf b/packages/dspam/pkg/clamd.conf deleted file mode 100644 index 3ce0402f..00000000 --- a/packages/dspam/pkg/clamd.conf +++ /dev/null @@ -1,299 +0,0 @@ -## -## Example config file for the Clam AV daemon -## Please read the clamd.conf(5) manual before editing this file. -## - - -# Comment or remove the line below. -#Example - -# Uncomment this option to enable logging. -# LogFile must be writable for the user running daemon. -# A full path is required. -# Default: disabled -#LogFile /tmp/clamd.log -LogFile /var/log/clamav/clamd.log - -# By default the log file is locked for writing - the lock protects against -# running clamd multiple times (if want to run another clamd, please -# copy the configuration file, change the LogFile variable, and run -# the daemon with --config-file option). -# This option disables log file locking. -# Default: no -#LogFileUnlock yes - -# Maximal size of the log file. -# Value of 0 disables the limit. -# You may use 'M' or 'm' for megabytes (1M = 1m = 1048576 bytes) -# and 'K' or 'k' for kilobytes (1K = 1k = 1024 bytes). To specify the size -# in bytes just don't use modifiers. -# Default: 1M -#LogFileMaxSize 2M - -# Log time with each message. -# Default: no -#LogTime yes - -# Also log clean files. Useful in debugging but drastically increases the -# log size. -# Default: no -#LogClean yes - -# Use system logger (can work together with LogFile). -# Default: no -#LogSyslog yes -LogSyslog yes - -# Specify the type of syslog messages - please refer to 'man syslog' -# for facility names. -# Default: LOG_LOCAL6 -#LogFacility LOG_MAIL - -# Enable verbose logging. -# Default: no -#LogVerbose yes - -# This option allows you to save a process identifier of the listening -# daemon (main thread). -# Default: disabled -#PidFile /var/run/clamd.pid -PidFile /var/run/clamav/clamd.pid - -# Optional path to the global temporary directory. -# Default: system specific (usually /tmp or /var/tmp). -#TemporaryDirectory /var/tmp - -# Path to the database directory. -# Default: hardcoded (depends on installation options) -#DatabaseDirectory /var/lib/clamav -DatabaseDirectory /usr/local/share/clamav - -# The daemon works in a local OR a network mode. Due to security reasons we -# recommend the local mode. - -# Path to a local socket file the daemon will listen on. -# Default: disabled (must be specified by a user) -#LocalSocket /tmp/clamd - -# Remove stale socket after unclean shutdown. -# Default: no -FixStaleSocket yes - -# TCP port address. -# Default: no -TCPSocket 3310 - -# TCP address. -# By default we bind to INADDR_ANY, probably not wise. -# Enable the following to provide some degree of protectiyes -# from the outside world. -# Default: no -TCPAddr 127.0.0.1 - -# Maximum length the queue of pending connections may grow to. -# Default: 15 -#MaxConnectionQueueLength 30 - -# Clamd uses FTP-like protocol to receive data from remote clients. -# If you are using clamav-milter to balance load between remote clamd daemons -# on firewall servers you may need to tune the options below. - -# Close the connection when the data size limit is exceeded. -# The value should match your MTA's limit for a maximal attachment size. -# Default: 10M -#StreamMaxLength 20M - -# Limit port range. -# Default: 1024 -#StreamMinPort 30000 -# Default: 2048 -#StreamMaxPort 32000 - -# Maximal number of threads running at the same time. -# Default: 10 -#MaxThreads 20 - -# Waiting for data from a client socket will timeout after this time (seconds). -# Value of 0 disables the timeout. -# Default: 120 -#ReadTimeout 300 - -# Waiting for a new job will timeout after this time (seconds). -# Default: 30 -#IdleTimeout 60 - -# Maximal depth directories are scanned at. -# Default: 15 -#MaxDirectoryRecursion 20 - -# Follow directory symlinks. -# Default: no -#FollowDirectorySymlinks yes - -# Follow regular file symlinks. -# Default: no -#FollowFileSymlinks yes - -# Perform internal sanity check (database integrity and freshness). -# Default: 1800 (30 min) -#SelfCheck 600 - -# Execute a command when virus is found. In the command string %v will -# be replaced by a virus name. -# Default: no -#VirusEvent /usr/local/bin/send_sms 123456789 "VIRUS ALERT: %v" - -# Run as a selected user (clamd must be started by root). -# Default: don't drop privileges -User clamav - -# Initialize supplementary group access (clamd must be started by root). -# Default: no -AllowSupplementaryGroups yes - -# Stop daemon when libclamav reports out of memory condition. -#ExitOnOOM yes - -# Don't fork into background. -# Default: no -#Foreground yes - -# Enable debug messages in libclamav. -# Default: no -#Debug yes - -# Do not remove temporary files (for debug purposes). -# Default: no -#LeaveTemporaryFiles yes - -## -## Executable files -## - -# PE stands for Portable Executable - it's an executable file format used -# in all 32-bit versions of Windows operating systems. This option allows -# ClamAV to perform a deeper analysis of executable files and it's also -# required for decompression of popular executable packers such as UPX, FSG, -# and Petite. -# Default: yes -#ScanPE yes - -# With this option clamav will try to detect broken executables and mark -# them as Broken.Executable -# Default: no -#DetectBrokenExecutables yes - - -## -## Documents -## - -# This option enables scanning of Microsoft Office document macros. -# Default: yes -#ScanOLE2 yes - -## -## Mail files -## - -# Enable internal e-mail scanner. -# Default: yes -#ScanMail yes - -# If an email contains URLs ClamAV can download and scan them. -# WARNING: This option may open your system to a DoS attack. -# Never use it on loaded servers. -# Default: no -#MailFollowURLs no - - -## -## HTML -## - -# Perform HTML normalisation and decryption of MS Script Encoder code. -# Default: yes -#ScanHTML yes - - -## -## Archives -## - -# ClamAV can scan within archives and compressed files. -# Default: yes -#ScanArchive yes - -# The options below protect your system against Denial of Service attacks -# using archive bombs. - -# Files in archives larger than this limit won't be scanned. -# Value of 0 disables the limit. -# Default: 10M -#ArchiveMaxFileSize 15M - -# Nested archives are scanned recursively, e.g. if a Zip archive contains a RAR -# file, all files within it will also be scanned. This options specifies how -# deep the process should be continued. -# Value of 0 disables the limit. -# Default: 8 -#ArchiveMaxRecursion 10 - -# Number of files to be scanned within an archive. -# Value of 0 disables the limit. -# Default: 1000 -#ArchiveMaxFiles 1500 - -# If a file in an archive is compressed more than ArchiveMaxCompressionRatio -# times it will be marked as a virus (Oversized.ArchiveType, e.g. Oversized.Zip) -# Value of 0 disables the limit. -# Default: 250 -#ArchiveMaxCompressionRatio 300 - -# Use slower but memory efficient decompression algorithm. -# only affects the bzip2 decompressor. -# Default: no -#ArchiveLimitMemoryUsage yes - -# Mark encrypted archives as viruses (Encrypted.Zip, Encrypted.RAR). -# Default: no -#ArchiveBlockEncrypted no - -# Mark archives as viruses (e.g. RAR.ExceededFileSize, Zip.ExceededFilesLimit) -# if ArchiveMaxFiles, ArchiveMaxFileSize, or ArchiveMaxRecursion limit is -# reached. -# Default: no -#ArchiveBlockMax no - - -## -## Clamuko settings -## WARNING: This is experimental software. It is very likely it will hang -## up your system!!! -## - -# Enable Clamuko. Dazuko (/dev/dazuko) must be configured and running. -# Default: no -#ClamukoScanOnAccess yes - -# Set access mask for Clamuko. -# Default: no -#ClamukoScanOnOpen yes -#ClamukoScanOnClose yes -#ClamukoScanOnExec yes - -# Set the include paths (all files in them will be scanned). You can have -# multiple ClamukoIncludePath directives but each directory must be added -# in a seperate line. -# Default: disabled -#ClamukoIncludePath /home -#ClamukoIncludePath /students - -# Set the exclude paths. All subdirectories are also excluded. -# Default: disabled -#ClamukoExcludePath /home/bofh - -# Don't scan files larger than ClamukoMaxFileSize -# Value of 0 disables the limit. -# Default: 5M -#ClamukoMaxFileSize 10M diff --git a/packages/dspam/pkg/default.prefs.sample b/packages/dspam/pkg/default.prefs.sample deleted file mode 100644 index d9be27ed..00000000 --- a/packages/dspam/pkg/default.prefs.sample +++ /dev/null @@ -1,43 +0,0 @@ -# $Id$ -# default.prefs v3.2 -# Default preferences for DSPAM - -# This file serves two purposes. First, it sets the default preferences each -# user will see when using the preferences section of the DSPAM Control -# Center. Second, it may be symbolically linked (or copied) into DSPAM_HOME to -# set the system-wide default preferences, overriding any commandline or -# dspam.conf parameters. If symlinked, an administrator can edit these options -# in the DSPAM Administrative Suite. - -# Training Mode: TEFT, TOE, TUM, NOTRAIN -trainingMode=TEFT - -# Spam Action: quarantine, tag -spamAction=quarantine - -# Spam Subject: the text to be prepended onto the subject line of tagged spams -spamSubject=[SPAM] - -# Bayesian Noise Reduction: on/off -enableBNR=on - -# Automatic Whitelisting: on/off -enableWhitelist=on - -# Statistical Sedation: 0-10 -statisticalSedation=5 - -# Signature Location: message, headers, attachment -signatureLocation=message - -# Whitelist Threshold: the minimum number of innocent hits from a recipient to -# be automatically whitelisted. Do not set this value too low! -whitelistThreshold=10 - -# showFactors: when set to on, the determining factors for each message will -# be added to a X-DSPAM-Factors message header. -showFactors=off - -# optIn/optOut: Depending on the opt mode set, you can also use one of these. -#optIn=on -#optOut=off diff --git a/packages/dspam/pkg/dspam-config.inc b/packages/dspam/pkg/dspam-config.inc deleted file mode 100644 index 211bee51..00000000 --- a/packages/dspam/pkg/dspam-config.inc +++ /dev/null @@ -1,42 +0,0 @@ - '/var/db/dspam', - 'DSPAM_BIN' => '/usr/local/bin', - 'DSPAM' => '/usr/local/bin/dspam', - 'DSPAM_STATS' => '/usr/local/bin/dspam_stats', - 'DSPAM_WWW' => '/usr/local/pkg', - 'DSPAM_ARGS' => '--deliver=innocent --class=innocent ' . - '--source=error --user %CURRENT_USER% -d %u', - 'DSPAM_ADMIN_GROUP' => 'dspam_admins', - 'ALL_PROCS' => 'ps auxw', - 'MAIL_QUEUE' => 'mailq | grep \'^[0-9,A-F]\' | wc -l', - 'HISTORY_SIZE' => 799, - 'HISTORY_PER_PAGE' => 100, - 'QUARANTINE_PER_PAGE' => 100, - 'HISTORY_DUPLICATES' => 'yes', - 'MAX_COL_LEN' => 26, - 'QNAV_BUTTONS' => 20, - 'HNAV_BUTTONS' => 22, - 'SORT_DEFAULT' => 'Rating', - '3D_GRAPHS' => 1, - 'USE_MAILPARSE' => 1, - 'OPTMODE' => 'NONE', - 'LOCAL_DOMAIN' => 'localhost', - 'AUTODETECT' => 1, - 'OPENSOURCE' => 0, - /* Is there a website which provides dedicated infos? */ - 'PACKAGE_WEBSITE' => 'http://www.pfsense.com/', - /* Is there a forum which provides dedicated infos? */ - 'PACKAGE_FORUM' => 'http://www.pfsense.com/', - /* - * Is there a issue tracker which allows to fill a - * support request or a bug report? - */ - 'PACKAGE_TRACKER' => 'http://www.pfsense.com/', - /* 'DATE_FORMAT' => '%d.%m.%Y %H:%M' */ - 'DATE_FORMAT' => '%b %d %H:%M' - ); - -?> diff --git a/packages/dspam/pkg/dspam-guifunc.inc b/packages/dspam/pkg/dspam-guifunc.inc deleted file mode 100644 index 121bc8b5..00000000 --- a/packages/dspam/pkg/dspam-guifunc.inc +++ /dev/null @@ -1,2606 +0,0 @@ -&1", "r"); - - while (!feof($pd)) { - $line = chop( fgets($pd, 4096) ); - - if ($b == "qrowEven") { - $b = "qrowOdd"; - } else { - $b = "qrowEven"; - } - - $line = preg_replace('/:/', ' ', $line); - - list($username, , $sl, , $il, , $fp, , $sm, , $sc, , $ic) - = (preg_split('/\s+/', $line)); - if ($username == "" && $sl == "") { - /* we do not want to display data that - * does not bleong to any user - */ - continue; - } else if ($sl == "") { - $line = fgets($pd, 4096); - $line = preg_replace('/:/', ' ', $line); - list(, , $sl, , $il, , $fp, , $sm, , $sc, , $ic) - = (preg_split('/\s+/', $line)); - } - - $PREFS =& GetPrefs($username, GetPath($username).".prefs"); - if ($PREFS['enableBNR'] == "on") { $PREFS['enableBNR'] = "OFF"; } - if ($PREFS['enableWhitelist'] == "on") { $PREFS['enableWhitelist'] = "OFF"; } - $PREFS['spamAction'] = ucfirst($PREFS['spamAction']); - $PREFS['enableBNR'] = strtoupper($PREFS['enableBNR']); - $PREFS['enableWhitelist'] = strtoupper($PREFS['enableWhitelist']); - - $mailbox = GetPath($username).".mbox"; - if ( file_exists($mailbox) ) { - $mailbox_size = filesize($mailbox); - $mailbox_display = sprintf("%2.1f KB", ($mailbox_size / 1024)); - $mailbox_total += $mailbox_size; - } - else { - $mailbox_display = "--"; - } - - $sl_total += $sl; - $il_total += $il; - $sm_total += $sm; - $fp_total += $fp; - $sc_total += $sc; - $ic_total += $ic; - - $DATA['TABLE'] .= "{$username}" . - " {$mailbox_display}" . - " {$sl}" . - " {$il}" . - " {$fp}" . - " {$sm}" . - " {$sc}" . - " {$ic}" . - " {$PREFS['trainingMode']}" . - " {$PREFS['spamAction']}" . - " {$PREFS['enableBNR']}" . - " {$PREFS['enableWhitelist']}" . - " {$PREFS['statisticalSedation']}" . - " {$PREFS['signatureLocation']}" . - "\n"; - } - pclose($pd); - - $mailbox_total_display = sprintf("%2.1f KB", ($mailbox_total / 1024)); - - $b = "listhdrr"; - $DATA['TABLE'] .= "Total". - " {$mailbox_total_display}". - " {$sl_total}". - " {$il_total}". - " {$sm_total}". - " {$fp_total}". - " {$sc_total}". - " {$ic_total}". - "  ". - "  ". - "  ". - "  ". - "  ". - "  ". - "\n"; -} - -function &DisplayStatus() { - global $CONFIG, $DATA; - - $LOG = "{$CONFIG['DSPAM_HOME']}/system.log"; - $spam_daily = array(); - $nonspam_daily = array(); - $period_daily = array(); - $fp_daily = array(); - $sm_daily = array(); - $inoc_daily = array(); - $whitelist_daily = array(); - $spam_weekly = array(); - $nonspam_weekly = array(); - $period_weekly = array(); - $fp_weekly = array(); - $sm_weekly = array(); - $inoc_weekly = array(); - $$whitelist_weekly = array(); - $msgpersecond = array(); - $classes = array(); - - list (, $min, $hour, $mday, $mon, $year, , ,) = (localtime(time())); - $hmstart = time() - 60; - $daystart = mktime(0, 0, 0, $mon, $mday, $year); - $periodstart = $daystart - (3600*24*24); /* 2 Weeks ago */ - $dailystart = time() - (3600*23); - $c_weekly = 0; /* Cursor to most recent time slot */ - $c_daily = 0; - - if (! file_exists($LOG)) { - return $input_errors[] = "No historical data is available (log file »{$LOG}« does not exist)."; - } - - /* Initialize each individual time period */ - - for ($i = 0; $i <= 23; $i++) { - $h = To12Hour($hour - (23-$i)); - $period_daily[$i] = $h; - $spam_daily[$i] = 0; - $nonspam_daily[$i] = 0; - $sm_daily[$i] = 0; - $fp_daily[$i] = 0; - $inoc_daily[$i] = 0; - } - - for ($i = 0; $i <= 23; $i++) { - $d = $daystart - (3600 * 24 * (24 - $i)); - list (, , , $lday, $lmon, $lyear, , ,) = (localtime($d)); - $lmon++; - $lyear += 1900; - $period_weekly[$i] = "{$lmon}/{$lday}/{$lyear}"; - $spam_weekly[$i] = 0; - $nonspam_weekly[$i] = 0; - $sm_weekly[$i] = 0; - $fp_weekly[$i] = 0; - $inoc_weekly[$i] = 0; - } - - if($fd = @fopen("{$LOG}", "r")) { - while (!feof($fd)) { - $line = fgets($fd, 4096); - list ($t_log, $c_log, , $signature, , $e_log) = preg_split('/\t/', $line); - if ($t_log > time()) { continue; } - - $last_message = $t_log; - - /* Only Parse Log Data in our Time Period */ - if ($t_log >= $periodstart) { - list (, $tmin, $thour, $tday, $tmon, $tyear) = (localtime($t_log)); - $tmon++; - $tyear += 1900; - - /* Weekly Graph */ - $c_weekly = 0; - while($period_weekly[$c_weekly] <> "{$tmon}/{$tday}/{$tyear}" && $c_weekly < 24) { - $c_weekly++; - } - - if ($c_log == "E") { - if ($classes[$signature] == "S") { - $spam_weekly[$c_weekly]--; - if ($spam_weekly[$c_weekly] < 0) { $spam_weekly[$c_weekly] = 0; } - } else if ($classes[$signature] == "I") { - $nonspam_weekly[$c_weekly]--; - if ($nonspam_weekly[$c_weekly] < 0) { $nonspam_weekly[$c_weekly] = 0; } - } else if ($classes[$signature] == "W") { - $whitelist_weekly[$c_weekly]--; - if ($whitelist_weekly[$c_weekly] < 0) { $whitelist_weekly[$c_weekly] = 0; } - } else if ($classes[$signature] == "F") { - $spam_weekly[$c_weekly]++; $fp_weekly[$c_weekly]--; - if ($fp_weekly[$c_weekly] < 0) { $fp_weekly[$c_weekly] = 0; } - } else if ($classes[$signature] == "M") { - $sm_weekly[$c_weekly]--; $nonspam_weekly[$c_weekly]++; - if ($sm_weekly[$c_weekly] < 0) { $sm_weekly[$c_weekly] = 0; } - } else if ($classes[$signature] == "N") { - $inoc_weekly[$c_weekly]--; - if ($inoc_weekly[$c_weekly] < 0) { $inoc_weekly[$c_weekly] = 0; } - } - } else { - $classes[$signature] = $c_log; - } - - if ($c_log == "S") { $spam_weekly[$c_weekly]++; } - if ($c_log == "I") { $nonspam_weekly[$c_weekly]++; } - if ($c_log == "W") { $whitelist_weekly[$c_weekly]++; } - if ($c_log == "F") - { $spam_weekly[$c_weekly]--; $fp_weekly[$c_weekly]++; - if ($spam_weekly[$c_weekly] < 0) { $spam_weekly[$c_weekly] = 0; } - } - if ($c_log == "M") - { $sm_weekly[$c_weekly]++; $nonspam_weekly[$c_weekly]--; - if ($nonspam_weekly[$c_weekly] < 0) { $nonspam_weekly[$c_weekly] = 0; } - } - if ($c_log == "N") { $inoc_weekly[$c_weekly]++; } - - - /* Daily Graph */ - if ($t_log >= $dailystart) { - while($period_daily[$c_daily] <> To12Hour($thour) && $c_daily < 24) { - $c_daily++; - } - - if ($c_log == "E") { - if ($classes[$signature] == "S") { - $spam_daily[$c_daily]--; - if ($spam_daily[$c_daily] < 0) { $spam_daily[$c_daily] = 0; } - } else if ($classes[$signature] == "I") { - $nonspam_daily[$c_daily]--; - if ($nonspam_daily[$c_daily] < 0) { $nonspam_daily[$c_daily] = 0; } - } else if ($classes[$signature] == "W") { - $whitelist_daily[$c_daily]--; - if ($whitelist_daily[$c_daily] < 0) { $whitelist_daily[$c_daily] = 0; } - } else if ($classes[$signature] == "F") { - $spam_daily[$c_daily]++; $fp_daily[$c_daily]--; - if ($fp_daily[$c_daily] < 0) { $fp_daily[$c_daily] = 0; } - } else if ($classes[$signature] == "M") { - $sm_daily[$c_daily]--; $nonspam_daily[$c_daily]++; - if ($sm_daily[$c_daily] < 0) { $sm_daily[$c_daily] = 0; } - } else if ($classes[$signature] == "N") { - $inoc_daily[$c_daily]--; - if ($inoc_daily[$c_daily] < 0) { $inoc_daily[$c_daily] = 0; } - } - } - - if ($c_log == "S") { $spam_daily[$c_daily]++; } - if ($c_log == "I") { $nonspam_daily[$c_daily]++; } - if ($c_log == "W") { $whitelist_daily[$c_daily]++; } - if ($c_log == "F") - { $spam_daily[$c_daily]--; $fp_daily[$c_daily]++; - if ($spam_daily[$c_daily] < 0) { $spam_daily[$c_daily] = 0; } - } - if ($c_log == "M") - { $sm_daily[$c_daily]++; $nonspam_daily[$c_daily]--; - if ($nonspam_daily[$c_daily] < 0) { $nonspam_daily[$c_daily] = 0; } - } - if ($c_log == "N") { $inoc_daily[$c_daily]++; } - } - - /* Last Half-Minute */ - if ($t_log >= $hmstart) { - $msgpersecond[$t_log]++; - $DATA['AVG_PROCESSING_TIME'] += $e_log; - $keycount_exectime++; - } - } - } // end while - - fclose($fd); - } else { - return $input_errors[] = "Unable to open logfile: {$LOG}."; - } // end if - - /* Calculate Avg. Messages Per Second */ - foreach(array_values($msgpersecond) as $el) { - $DATA['AVG_MSG_PER_SECOND'] += $el; - } - $DATA['AVG_MSG_PER_SECOND'] /= 60; - $DATA['AVG_MSG_PER_SECOND'] = sprintf("%2.2f", $DATA['AVG_MSG_PER_SECOND']); - - /* Calculate Avg. Processing Time */ - if ($keycount_exectime == 0) { - $DATA['AVG_PROCESSING_TIME'] = 0; - } else { - $DATA['AVG_PROCESSING_TIME'] /= $keycount_exectime; - } - $DATA['AVG_PROCESSING_TIME'] = sprintf("%01.6f", $DATA['AVG_PROCESSING_TIME']); - - /* Calculate Number of processes, Uptime and Mail Queue length */ - $pd = popen("{$CONFIG['ALL_PROCS']} | grep dspam | grep -v grep | grep -v cgi | grep -v sock | wc -l", "r"); - $DATA['DSPAM_PROCESSES'] = fgets($pd, 4096); - pclose($pd); - - $pd = popen("uptime", "r"); - $DATA['UPTIME'] = fgets($pd, 4096); - pclose($pd); - - $pd = popen("{$CONFIG['MAIL_QUEUE']}", "r"); - $DATA['MAIL_QUEUE'] = fgets($pd, 4096); - pclose($pd); - - /* Calculate Graphs */ - $DATA['SPAM_TODAY'] = $spam_weekly[24]; - $DATA['NONSPAM_TODAY'] = $nonspam_weekly[24]; - $DATA['SM_TODAY'] = $sm_weekly[24]; - $DATA['FP_TODAY'] = $fp_weekly[24]; - $DATA['INOC_TODAY'] = $inoc_weekly[24]; - $DATA['TOTAL_TODAY'] = $DATA['SPAM_TODAY'] + $DATA['NONSPAM_TODAY'] + $DATA['SM_TODAY'] - + $DATA['FP_TODAY'] + $DATA['INOC_TODAY']; - - $DATA['SPAM_THIS_HOUR'] = $spam_daily[23]; - $DATA['NONSPAM_THIS_HOUR'] = $nonspam_daily[23]; - $DATA['SM_THIS_HOUR'] = $sm_daily[23]; - $DATA['FP_THIS_HOUR'] = $fp_daily[23]; - $DATA['INOC_THIS_HOUR'] = $inoc_daily[23]; - $DATA['TOTAL_THIS_HOUR'] = $DATA['SPAM_THIS_HOUR'] + - + $DATA['NONSPAM_THIS_HOUR'] - + $DATA['SM_THIS_HOUR'] - + $DATA['FP_THIS_HOUR'] - + $DATA['INOC_THIS_HOUR']; - - if (is_array($spam_daily) && - is_array($nonspam_daily) && - is_array($sm_daily) && - is_array($fp_daily) && - is_array($inoc_daily) && - is_array($whitelist_daily) && - is_array($period_daily)) { - $DATA['DATA_DAILY'] = join(",", $spam_daily) - . "_" - . join(",", $nonspam_daily) - . "_" - . join(",", $sm_daily) - . "_" - . join(",", $fp_daily) - . "_" - . join(",", $inoc_daily) - . "_" - . join(",", $whitelist_daily) - . "_" - . join(",", $period_daily); - - foreach($spam_daily as $el){ $DATA['TS_DAILY'] += $el; }; - foreach($nonspam_daily as $el){ $DATA['TI_DAILY'] += $el; } - foreach($sm_daily as $el){ $DATA['SM_DAILY'] += $el; } - foreach($fp_daily as $el){ $DATA['FP_DAILY'] += $el; } - foreach($inoc_daily as $el){ $DATA['INOC_DAILY'] += $el; } - foreach($whitelist_daily as $el){ $DATA['TI_DAILY'] += $el; } - } - - if (is_array($spam_weekly) && - is_array($nonspam_weekly) && - is_array($sm_weekly) && - is_array($fp_weekly) && - is_array($inoc_weekly) && - is_array($whitelist_weekly) && - is_array($period_weekly)) { - $DATA['DATA_WEEKLY'] = join(",", $spam_weekly) - . "_" - . join(",", $nonspam_weekly) - . "_" - . join(",", $sm_weekly) - . "_" - . join(",", $fp_weekly) - . "_" - . join(",", $inoc_weekly) - . "_" - . join(",", $whitelist_weekly) - . "_" - . join(",", $period_weekly); - - foreach($spam_weekly as $el){ $DATA['TS_WEEKLY'] += $el; } - foreach($nonspam_weekly as $el){ $DATA['TI_WEEKLY'] += $el; } - foreach($sm_weekly as $el){ $DATA['SM_WEEKLY'] += $el; } - foreach($fp_weekly as $el){ $DATA['FP_WEEKLY'] += $el; } - foreach($inoc_weekly as $el){ $DATA['INOC_WEEKLY'] += $el; } - foreach($whitelist_weekly as $el){ $DATA['TI_WEEKLY'] += $el; } - } -} - -function &DisplayInfos() { - global $CONFIG, $DATA, $g; - $validity = "valide"; - - $pd = @popen("{$CONFIG['DSPAM']} --version", "r"); - fgets($pd, 4096); // ignore 1st line - $DATA['DSPAM_VERSION'] = fgets($pd, 4096); - fgets($pd, 4096); // ignore next line - $DATA['DSPAM_COPYRIGHT'] = fgets($pd, 4096); - $DATA['DSPAM_WEBSITE'] = fgets($pd, 4096); - fgets($pd, 4096); // ignore next line - $DATA['DSPAM_COPYRIGHT_TEXT'] = fgets($pd, 4096); - $DATA['DSPAM_COPYRIGHT_TEXT'] .= " " . fgets($pd, 4096); - fgets($pd, 4096); // ignore next line - $DATA['DSPAM_CONFIGURE_ARGS'] = str_replace("Configuration parameters: ", "", fgets($pd, 4096)); - - pclose($pd); - - if (file_exists("{$g['conf_path']}/nione.lic") && - file_exists("{$g['conf_path']}/nione.lic.sha1")) { - if ($fd = @fopen("{$g['conf_path']}/nione.lic", "r")) { - $owneru = str_replace("Licensed User: ", "", fgets($fd, 4096)); - if ($owneru == "") { $validity = "invalide (owner data not found)"; } - $ownerc = str_replace("Company: ", "", fgets($fd, 4096)); - if ($ownerc == "") { $validity = "invalide (company not found)"; } - $lkey = str_replace("License Key: ", "", fgets($fd, 4096)); - if ($lkey == "") { $validity = "invalide (license key not found)"; } - $pdate = strtotime( str_replace("Purchase Date: ", "", fgets($fd, 4096)) ); - if ($pdate == "") { $validity = "invalide (purchase date not found)"; } - - fclose($fd); - } else { - $validity = "invalide (license files not found)"; - } - - if(! extension_loaded( 'bcompiler' )) { - if(@dl( 'bcompiler.so' )) { - require_once ("knione"); - $gen_lkey = getNIONEKey(trim($owneru), trim($ownerc)); - if (trim($lkey) <> $gen_lkey) { $validity = "invalide (wrong license key)"; } - - $cdate = mktime(0, 0, 0, date("m"), - date("d"), - date("Y")); - - $edate = mktime(0, 0, 0, date("m", $pdate), - date("d", $pdate), - date("Y", $pdate)+1); - - if ($edate < $cdate || - $pdate > $cdate) { - $validity = "invalide (license expired)"; - } - - if ($fd = @fopen("{$g['conf_path']}/nione.lic.sha1", "r")) { - $chksum = str_replace("SHA1 (nione.lic) = ", "", fgets($fd, 4096)); - $chksum_new = sha1_file("{$g['conf_path']}/nione.lic"); - - if (trim($chksum) !== trim($chksum_new)) { - $validity = "invalide (wrong license file checksum)"; - } - - fclose($fd); - } else { - $validity = "invalide (license files not found)"; - } - } else { - $validity = "invalide (extension missing, which is necessary to validate license data.)"; - } - } - } else { - $validity = "invalide (license files not found)"; - } - - $DATA['OWNER'] = $owneru; - $DATA['COMPANY'] = $ownerc; - $DATA['LICENSE_KEY'] = $lkey; - $DATA['LICENSE_VALIDITY'] = $validity; - $DATA['PURCHASE_DATE'] = date("F j, Y", $pdate); - $DATA['EXPIRY_DATE'] = date("F j, Y", $edate); -} - -/* ========================================================================== */ -/* = H I S T O R Y F U N C T I O N S = */ -/* ========================================================================== */ - -function &DisplayFragment($sigID = "", - $from = "", - $subject = "", - $info = "", - $time = "") { - global $DATA, $USER; - - $sigID = preg_replace('/\/', '///', $sigID); - - $DATA['FROM'] = $from; - $DATA['SUBJECT'] = $subject; - $DATA['INFO'] = $info; - $DATA['TIME'] = $time; - - if($fd = @fopen("{$USER}.frag/{$sigID}.frag", "r")) { - while (!feof($fd)) { - /* sanitize HTML markup */ - $line = preg_replace("//e", "'>'", $line); - $DATA['MESSAGE'] .= $line; - } - fclose($fd); - } else { - return $input_errors[] = "Unable to open file {$USER}.frag/{$sigID}.frag."; - } -} - -function &DisplayHistory($command = "", - $sigID= "", - $retrainChecked = array(), - $username = "", - $retrainParam = "", - $currentPage = 1, - $hPerPage = 0) { - global $CONFIG, $USER, $CURRENT_USER, $DATA; - - $buffer = array(); - $history = array(); - $rec = array(); - $rowclass = "rowEven"; - - if ($command == "retrainChecked" && count ($retrainChecked) > 0) { - foreach($retrainChecked as $el) { - list ($retrain, $signature) = split(":", $el); - if ($retrain == "innocent") { - ProcessFalsePositive(quotemeta($signature)); - } else if ($retrain == "innocent" || $retrain == "spam") { - system("{$CONFIG['DSPAM']} --source=error --class=" . quotemeta($retrain) . - " --signature=" . quotemeta($signature) . - " --user " . quotemeta($CURRENT_USER)); - } - } - // TODO: Do we need the other params which were submited during the current - // POS/GET request? - pfSenseHeader("/dspam-history.php?user={$username}&page={$currentPage}&hperpage={$hPerPage}"); - } else { - if ($retrainParam <> "") { - if ($retrainParam == "innocent") { - ProcessFalsePositive(); - } else { - system("{$CONFIG['DSPAM']} --source=error --class=" . quotemeta($retrainParam) . - " --signature=" . quotemeta($sigID) . - " --user " . quotemeta($CURRENT_USER)); - } - // TODO: Do we need the other params which were submited during the current - // POS/GET request? - pfSenseHeader("/dspam-history.php?user={$username}&page={$currentPage}&hperpage={$hPerPage}"); - } - } - - $LOG = "{$USER}.log"; - if (! file_exists($LOG)) { - return $input_errors[] = "No historical data is available (log file »{$USER}.log« does not exist)."; - } - - /* Preseed retraining information and delivery errors */ - - $fd = fopen($LOG, "r"); - while (!feof($fd)) { - /* TODO: If the subject line contains a , the below array would - * contain more then seven elements and thus would be invalide. - * - * The below code is some kind of a bug fix. - */ - $cline = fgets($fd, 4096); - $log_columns = preg_split("/\t/", $cline); - list($time, $class, $from, $signature, $subject, $info, $messageid) = $log_columns; - if (count ($log_columns) > 7) { - /* get values from the array beginning */ - $time = array_shift($log_columns); - $class = array_shift($log_columns); - $from = array_shift($log_columns); - $signature = array_shift($log_columns); - /* get msgid and info from the array end */ - $messageid = array_pop($log_columns); - $info = array_pop($log_columns); - /* the remaining parts are belonging to the subject */ - $subject = implode(" ", $log_columns); - } - - if ($signature == "") { continue; } - if ($class == "M" || $class == "F" || $class == "E") { - if ($class == "E") { - $rec[$signature]['info'] = $info; - } else if ($class == "F" || $class == "M") { - $rec[$signature]['class'] = $class; - $rec[$signature]['count']++; - if ($rec[$signature]['info'] == "") - { $rec[$signature]['info'] = $info; } - } - /* filter out resents if there are any. Since it's the same - * message we only allow retraining on the 1st occurence of it. - */ - } else if ($messageid == "" || - $rec[$signature]['messageid'] != $messageid || - $CONFIG['HISTORY_DUPLICATES'] <> "no") { - $rec[$signature]['time'] = $time; - $rec[$signature]['class'] = $class; - $rec[$signature]['from'] = $from; - $rec[$signature]['signature'] = $signature; - $rec[$signature]['subject'] = $subject; - $rec[$signature]['info'] = $info; - $rec[$signature]['messageid'] = $messageid; - - array_unshift($buffer, $rec[$signature]); - } - } // end while - fclose($fd); - - /* if the page size wasn't specified, set a default one */ - if ($CONFIG['HISTORY_PER_PAGE'] == 0) { - $CONFIG['HISTORY_PER_PAGE'] = 50; - } - - if (isset($hPerPage) && $hPerPage > 0) { - $CONFIG['HISTORY_PER_PAGE'] = $hPerPage; - } - - if (isset($currentPage) && isset($CONFIG['HISTORY_PER_PAGE'])) { - $pages = ceil( (count ($buffer) / $CONFIG['HISTORY_PER_PAGE']) ); - $begin = (($currentPage - 1) * $CONFIG['HISTORY_PER_PAGE']); - $ranges = ceil ($pages / $CONFIG['HNAV_BUTTONS']); - - /* Now lets just keep the information that we really need. */ - $buffer = array_splice($buffer, $begin, $CONFIG['HISTORY_PER_PAGE']); - } - - $retrain_checked_msg_no = 0; - while ($rec = array_pop($buffer)) { - $time = $rec['time']; - $class = $rec['class']; - $from = $rec['from']; - $signature = $rec['signature']; - $subject = $rec['subject']; - $info = $rec['info']; - $messageid = $rec['messageid']; - - if ($signature == "") { continue; } - if ($rec[$signature]['displayed'] <> "") { continue; } - if ($class == "E") { continue; } - $rec[$signature]['displayed'] = 1; - - /* Resends of retrained messages will need the original from/subject line */ - if ($messageid <> "") { - if ($from == "") { $from = $rec[$messageid]['from']; } - if ($subject == "") { $subject = $rec[$messageid]['subject']; } - - - if ($rec[$messageid]['from'] == "") { $rec[$messageid]['from'] = $from; } - if ($rec[$messageid]['subject'] == "") { $rec[$messageid]['subject'] = $subject; } - } - - if ($from == "") { $from = ""; } - if ($subject == "") { $subject = ""; } - - $ctime = ""; - if(isset($CONFIG["DATE_FORMAT"])) { - $ctime = strftime($CONFIG["DATE_FORMAT"], localtime($time)); - } else { - /* date format was taken from ctime.pl */ - $ctime = date ("D M d H:i:s TY",$time); - $ttmp = preg_split("/\s+/", $ctime); - $t = preg_split("/\:/", $ttmp[3]); - $xtmp = preg_split("/\s+/", $ctime); - $x = $xtmp[0]; - $m = "a"; - if ($t[0] > 12) { $t[0] -= 12; $m = "p"; } - if ($t[0] == 0) { $t[0] = 12; } - $ctime = "{$x} {$t[0]}:{$t[1]}{$m}"; - } - - /* Set the appropriate type and label for this message */ - - $cl = ""; - $cllabel = ""; - if ($rec[$signature]['class'] <> "") { $class = $rec[$signature]['class']; } - if ($class == "S") { $cl = "spam"; $cllabel="SPAM"; } - else if ($class == "I") { $cl = "innocent"; $cllabel="Good"; } - else if ($class == "F") { - if (fmod($rec[$signature]['count'], 2) != 0) { - $cl = "false"; $cllabel="Miss"; - } else { - $cl = "innocent"; $cllabel="Good"; - } - } - else if ($class == "M") { - if (fmod($rec[$signature]['count'], 2) != 0) { - $cl = "missed"; $cllabel="Miss"; - } else { - $cl = "spam"; $cllabel="SPAM"; - } - } - else if ($class == "N") { $cl = "inoculation"; $cllabel="Spam"; } - else if ($class == "C") { $cl = "blacklisted"; $cllabel="RBL"; } - else if ($class == "W") { $cl = "whitelisted"; $cllabel="Whitelist"; } - if ($messageid <> "") { - if ($rec[$messageid]['resend'] <> "") { - $cl = "relay"; - $cllabel = "Resend"; - } - $rec[$messageid]['resend'] = $signature; - } - - if ($rec[$signature]['info'] <> "") { $info = $rec[$signature]['info']; } - - /* sanitize HTML markup */ - $from = preg_replace("//e", "'>'", $from); - $subject = preg_replace('//e', "'>'", $subject); - - if (strlen($from) > $CONFIG['MAX_COL_LEN']) { $from = substr($from, 0, $CONFIG['MAX_COL_LEN']) . "..."; } - if (strlen($subject) > $CONFIG['MAX_COL_LEN']) { $subject = substr($subject, 0, $CONFIG['MAX_COL_LEN']) . "..."; } - - $rclass = ""; - if ($class == "I" || $class == "W" || $class == "F") { $rclass = "spam"; } - if ($class == "S" || $class == "M") { $rclass = "innocent"; } - - $retrain = ""; - if (preg_match('/^(M|F)$/', $rec[$signature]['class']) > 0 && - fmod($rec[$signature]['count'], 2) != 0) { - $retrain = "Retrained"; - } - - if ($retrain == "") { - $retrain = "As " . ucfirst($rclass) . ""; - } else { - $retrain .= "(Undo)"; - } - - $path = "{$USER}.frag/{$signature}.frag"; - if (file_exists($path)) { - $pairs = array(); - $pairs['template'] = "fragment"; - $pairs['signatureID'] = $signature; - $sub = $subject; - $sub = preg_replace('/#/e', '//', $sub); - $sub = preg_replace("/(['])/e", '/\\$1/', $sub); - $pairs['subject'] = $sub; - $pairs['from'] = $from; - $pairs['info'] = $info; - $pairs['time'] = $ctime; - $pairs['user'] = $username; - $pairs['page'] = $currentPage; - $pairs['hperpage'] = $hPerPage; - $url = SafeVars($pairs); - $from = "{$from}"; - } - - $entry = << - {$cllabel} - - - - - - - {$ctime} - {$from} - {$subject} - {$info} - - -EOD; - - $retrain_checked_msg_no++; - array_push($history, $entry); - - if ($rowclass == "qrowEven") { - $rowclass = "qrowOdd"; - } else { - $rowclass = "qrowEven"; - } - $hurtz++; - } // end while - - $entry = << - -EOD; - array_push($history, $entry); - - while($line = array_pop($history)) { $DATA['HISTORY'] .= $line; } - - if ($CONFIG['HISTORY_PER_PAGE'] > 0) { - /* prepare quarantine navbar */ - if (($currentPage - 1) >= 1) { $previousPage = $currentPage - 1; } - else { $previousPage = 1; } - - if (($currentPage + 1) <= $pages) { $nextPage = $currentPage + 1; } - else { $nextPage = $pages; } - - $historyFooterBegin = << - - |<  - <  - -EOD; - - $historyFooterEnd = <<>  - >| - - - -EOD; - - $ranges_array = array(); - $rpages = $pages; - for ($i = 0; $i < $ranges; $i++) { - $range = array(); - $range['start'] = (($i + 1)* $CONFIG['HNAV_BUTTONS']) - ($CONFIG['HNAV_BUTTONS'] - 1); - - if (($i + 1) == $ranges) { - $range['end'] = ($range['start'] + $rpages) - 1; - } else { - $range['end'] = (($i + 1)* $CONFIG['HNAV_BUTTONS']); - $rpages -= $CONFIG['HNAV_BUTTONS']; - } - - $ranges_array[$i] = $range; - } - - /* generate nav buttons */ - foreach($ranges_array as $range){ - if ($currentPage >= $range['start'] && $currentPage <= $range['end']) { - for ($i = $range['start']; ; $i++) { - if ($i > $range['end']) { - break; - } else { - if ($i == $currentPage) { - $historyFooter .= "{$i} \n"; - } else { - $historyFooter .= "{$i} \n"; - } - } - } - } - } - - $DATA['HISTORY_FOOTER'] = $historyFooterBegin . $historyFooter .$historyFooterEnd; - $DATA['HPAGES'] = $pages; - $DATA['HPAGE'] = $currentPage; - -/* - $DATA['HISTORY'] .= "
["; - if (($history_pages > 1) && ($history_page > 1)) { - $i = $history_page - 1; - $DATA['HISTORY'] .= " < "; - } - for($i = 1; $i <= $history_pages; $i++) { - if ($i == $history_page) { - $DATA['HISTORY'] .= " $i "; - } else { - $DATA['HISTORY'] .= " {$i} "; - } - } - if (($history_pages > 1) && ($history_page < $history_pages)) { - $i = $history_page + 1; - $DATA['HISTORY'] .= " > "; - } - $DATA['HISTORY'] .= "]
"; -*/ - } // end if -} - -/* ========================================================================== */ -/* = A N A L Y S I S F U N C T I O N S = */ -/* ========================================================================== */ - -function &DisplayAnalysis() { - global $USER, $CURRENT_USER, $CONFIG, $DATA; - $LOG = "{$USER}.log"; - - $Stats = array( - "daily" => array(), - "weekly" => array() - ); - - list(, $min, $hour, $mday, $mon, $year, , ,) = (localtime(time())); - $daystart = mktime(0, 0, 0, $mon, $mday, $year); - $periodstart = $daystart - (3600 * 24 * 13); /* 2 Weeks ago */ - $dailystart = time() - (3600 * 23); - - /* TODO: There's an issue that the Perl timelocal returns - * different values compared to PHP's mktime. There's a - * difference of 2678400, which will be added manually below. - */ - $daystart += 2678400; - $periodstart += 2678400; - - if (file_exists($LOG)) { - if ($fd = @fopen($LOG, "r")) { - $scount = 0; - $icount = 0; - $wcount = 0; - $fcount = 0; - $mcount = 0; - - while(!feof($fd)) { - $buffer = fgets($fd, 4096); - /* drop blank lines */ - if (strlen($buffer) == 0) { continue; } - list($t_log, $c_log) = preg_split("/\t/", $buffer); - - /* Only Parse Log Data in our Time Period */ - /* TODO: The below if should evaluate to true at least for some data */ - if ($t_log >= $periodstart) { - list(, $tmin, $thour, $tday, $tmon, , , ,) = (localtime($t_log)); - $tmon++; - - foreach (array('weekly', 'daily') as $period) { - $idx = 0; - if ($period == "weekly") { - $idx= "{$tmon}/{$tday}"; - } else { - if ($t_log <= $dailystart) { continue; } - $idx = To12Hour($thour); - } - if (is_array($Stats[$period]) && ! array_key_exists ($idx, $Stats[$period])) { - $Stats[$period][$idx] = array( - 'nonspam' => 0, - 'spam' => 0, - 'title' => $idx, - 'idx' => $t_log); - } - /* TODO: Is passing by reference here correct? */ - $hr =& $Stats[$period][$idx]; - /* S => spam */ - if ($c_log== "S") { - $hr['spam']++; - $scount++; - } - /* I => innocent W => whitelisted */ - if ($c_log == "I" || $c_log == "W") { - $hr['nonspam']++; - if ($c_log == "I") { $icount++; } - else { $wcount++; } - } - /* F => false positive */ - if ($c_log == "F") { - $hr['spam']--; - if ($hr['spam'] < 0) { $hr['spam'] = 0; } - $hr['nonspam']++; - $fcount++; - } - /* M => spam miss */ - if ($c_log == "M") { - $hr['nonspam']--; - if ($hr['nonspam'] < 0) { $hr['nonspam'] = 0; } - $hr['spam']++; - $mcount++; - } - } - } - } - - fclose($fd); - } else { - return $input_errors[] = "Unable to open log file: {$LOG}."; - } - - usort ((array_values ($Stats[$period])), "cmpArrayValues"); - - foreach (array('weekly', 'daily') as $period) { - $uc_period = strtoupper($period); - $hk = "DATA_{$uc_period}"; - $lst = array(); - - foreach (array_values($Stats[$period]) as $hr) { - foreach (array('spam', 'nonspam', 'title') as $type ) { - - if (empty($lst[$type])) { - $lst[$type] = array(); - } - - /* populate (newly) created array */ - $lst[$type][] = $hr[$type]; - - $totk=""; - - if ($type == "spam") { $totk="S"; } - else if ($type == "nonspam") { $totk="I"; } - - if ($totk == "") { continue; } - - $sk="T{$totk}_{$uc_period}"; - if (empty($DATA[$sk])) { $DATA[$sk] = 0; } - - $DATA[$sk] += $hr[$type]; - } - } // end foreach - $DATA[$hk] = - @join(",",$lst['spam']) . "_" . - @join(",",$lst['nonspam']) . "_" . - @join(",",$lst['title']); - } // end foreach - } else { - return $input_errors[] = "No historical data is available (log file »{$LOG}« does not exist)."; - } // end if -} - -function cmpArrayValues($a, $b) { - if ($a['idx'] == $b['idx']) - return 0; - - return ($a['idx'] < $b['idx']) ? -1 : 1; -} - -/* ========================================================================== */ -/* = P E R E F E R E N C E S F U N C T I O N S = */ -/* ========================================================================== */ - -function &DisplayPreferences($mode = "", &$statusmsg){ - global $USER, $CURRENT_USER, $CONFIG, $DATA; - $FILE = "{$USER}.prefs"; - $username = $CURRENT_USER; - - if ($_POST) { - $pconfig = $_POST; - - if ($pconfig['chk_feature_nr'] <> "on") { - $pconfig['chk_feature_nr'] = "off"; - } - - if ($pconfig['chk_feature_optin'] <> "on") { - $pconfig['chk_feature_optin'] = "off"; - } - - if ($pconfig['chk_feature_optout'] <> "on") { - $pconfig['chk_feature_optout'] = "off"; - } - - if ($pconfig['chk_feature_at'] <> "on") { - $pconfig['chk_feature_at'] = "off"; - } - - if ($pconfig['chk_feature_aw'] <> "on") { - $pconfig['chk_feature_aw'] = "off"; - } - - if ($CONFIG['PREFERENCES_EXTENSION'] == 1) { - if ($pconfig['msgtag'] == "") { - $pconfig['msgtag'] = "''"; - } else { - $pconfig['msgtag'] = quotemeta($pconfig['msgtag']); - } - - exec("{$CONFIG['DSPAM_BIN']}/dspam_admin ch pref " . quotemeta($username) . - " trainingMode " . quotemeta($pconfig['rad_train']) . " > /dev/null"); - exec("{$CONFIG['DSPAM_BIN']}/dspam_admin ch pref " . quotemeta($username) . - " spamAction " . quotemeta($pconfig['rad_train_action']) . " > /dev/null"); - exec("{$CONFIG['DSPAM_BIN']}/dspam_admin ch pref " . quotemeta($username) . - " signatureLocation " . quotemeta($pconfig['signatureLocation']) . " > /dev/null"); - exec("{$CONFIG['DSPAM_BIN']}/dspam_admin ch pref " . quotemeta($username) . - " spamSubject " . quotemeta($pconfig['msgtag']) . " > /dev/null"); - exec("{$CONFIG['DSPAM_BIN']}/dspam_admin ch pref " . quotemeta($username) . - " statisticalSedation " . quotemeta($pconfig['rad_filter_sens']) . " > /dev/null"); - exec("{$CONFIG['DSPAM_BIN']}/dspam_admin ch pref " . quotemeta($username) . - " enableBNR " . quotemeta($pconfig['chk_feature_nr']) . " > /dev/null"); - exec("{$CONFIG['DSPAM_BIN']}/dspam_admin ch pref " . quotemeta($username) . - " optOut " . quotemeta($pconfig['chk_feature_optout']) . " >/dev/null"); - exec("{$CONFIG['DSPAM_BIN']}/dspam_admin ch pref " . quotemeta($username) . - " optIn " . quotemeta($pconfig['chk_feature_optin']) . " >/dev/null"); - exec("{$CONFIG['DSPAM_BIN']}/dspam_admin ch pref " . quotemeta($username) . - " showFactors " . quotemeta($pconfig['chk_feature_at']) . " > /dev/null"); - exec("{$CONFIG['DSPAM_BIN']}/dspam_admin ch pref " . quotemeta($username) . - " enableWhitelist " . quotemeta($pconfig['chk_feature_aw']) . " > /dev/null"); - } else { - $prefsstr = << 0) { - if ($mode == 0) { $mode = 1; } - else { continue; } - } - - $buff = array_shift($buffer); - if (preg_match('/^From /', $buff) == 0) { - array_push($temp, $buff); - } - - continue; - } - - foreach($temp as $tempel) { - if ($tempel == "") { break; } - list($key, $val) = preg_split('/\: ?/', $tempel, 2); - $head[$key] = $val; - } - if ($head['X-DSPAM-Signature'] == $sigID) { - $found = 1; - $old_erep = error_reporting(E_ALL); - if ($pd = @popen("|{$CONFIG['DSPAM']} {$CONFIG['DSPAM_ARGS']} >{$TMPFILE} 2>&1", "w")) { - $pdresult = fread($handle, 2096); - - foreach($temp as $tempel) { - fwrite($pd, "{$tempel}\n"); - } - - pclose($pd); - error_reporting($old_erep); - } else { - $error = true; - $input_errors[] = "Unable to ope process pipe in function ProcessFalsePositive."; - } - } - } - - /* Couldn't find the message, so just retrain on signature */ - if (!$found) { - system("$CONFIG{'DSPAM'} --source=error --class=innocent --signature=" . quotemeta($sigID) . - " --user " . quotemeta($CURRENT_USER)); - } - - if ($error) { - $log = array(); - $fd = fopen("{$TMPFILE}", "r"); - while (!feof($handle)) { - $log .= fgets($fd, 4096); - } - fclose($fd); - unlink("{$TMPFILE}"); - return $input_errors[] = $log; - } - - unlink("{$TMPFILE}"); - $signatures[$sigID] = "on"; - return QuarantineDeleteSpam("", $signatures, $sortBy, $currentPage, $qPerPage); -} - -function &QuarantineManyNotSpam($signatures = array(), $sortBy = "Rating", $currentPage = 1, $qPerPage = 0){ - global $MAILBOX, $USER; - $buffer = array(); - $errors = array(); - - /* read the user's mailbox line by line into a buffer */ - $fd = fopen("{$MAILBOX}", "r"); - while (!feof($fd)) { - $line = chop(fgets($fd, 4096)); - array_push($buffer, $line); - } - fclose ($fd); - - if ($fd_FILE = @fopen("{$MAILBOX}", "w")) { - $fd_RETRAIN = fopen("{$USER}.retrain.log", "a"); - - /* iterate over the mailbox buffer */ - reset($buffer); - $i = 0; - while ($i < count($buffer)) { - $temp = array(); - $head = array(); - $mode = 0; - $buff = ""; - - /* this while tries to iterate over one single mesage including - * the message header and the message body. - */ - while((preg_match('/^From /', $buff) == 0) && ($i < count($buffer))) { - $buff = $buffer[0]; - - /* switch mode if we are hitting DSPAMs - * pseudo From QUARANTINE line (without a - * colon after the From). - */ - if (preg_match('/^From /', $buff) > 0) { - if ($mode == 0) { - $mode = 1; - $buff = array_shift($buffer); - array_push($temp, $buff); - $buff = ""; - continue; - } else { - continue; - } - } - - $buff = array_shift($buffer); - array_push($temp, $buff); - - continue; - } - - /* populate the header array with header fields */ - foreach($temp as $tempel) { - if ($tempel == "") { break; } - list($key, $val) = preg_split('/\: ?/', $tempel, 2); - $head[$key] = $val; - } - - $delivered = 0; - if ($signatures["chkmsg-{$head['X-DSPAM-Signature']}"] <> "") { - $err = Deliver($temp); - if ($err == "") { - $delivered = 1; - } else { - array_push($errors, $err); - } - } - if (!$delivered) { - foreach($temp as $tempel) { - fwrite($fd_FILE, "{$tempel}\n"); - } - } else { - fwrite($fd_RETRAIN, strval(time()) . "\t{$head['X-DSPAM-Signature']}\tinnocent\n"); - } - - $i++; - } // end while - - fclose($fd_FILE); - fclose($fd_RETRAIN); - } else { - return $input_errors[] = "Unable to open mailbox file: {$MAILBOX}."; - } - - if (count($errors) > 0) { - return $errors; - } - - return DisplayQuarantine($sortBy, $currentPage, $qPerPage); -} - -function Deliver($temp = array()) { - global $CONFIG; - - if (! file_exists("/tmp/dspam-error-output.txt")) { - touch("/tmp/dspam-error-output.txt"); - } - $descriptorspec = array( - 0 => array("pipe", "r"), // stdin is a pipe that the child will read from - 1 => array("pipe", "w"), // stdout is a pipe that the child will write to - 2 => array("file", "/tmp/dspam-error-output.txt", "a") // stderr is a file to write to - ); - - list($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$sizeb, - $atime,$mtimeb,$ctime,$blksize,$blocks) - = stat("/tmp/dspam-error-output.txt"); - clearstatcache(); - - $cwd = '/tmp'; - $process = @proc_open("{$CONFIG['DSPAM']} {$CONFIG['DSPAM_ARGS']}", - $descriptorspec, - $pipes); - - if (is_resource($process)) { - foreach($temp as $tempel) { - if (! @fwrite($pipes[0], "{$tempel}\n")) { - return "error while writting to pipe."; - } - } - - fclose($pipes[0]); - fclose($pipes[1]); - $return_value = proc_close($process); - - /* this isn't an elegant solution to determine whether - * DSPAM did report some errors, but it works for now - */ - list($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$sizea, - $atime,$mtimea,$ctime,$blksize,$blocks) - = stat("/tmp/dspam-error-output.txt"); - - if ($mtimeb <> $mtimea) { return "DSPAM did report some errors to /tmp/dspam-error-output.txt.\n" . - "Please check this particular file."; } - } else { - return "process is not a resource type."; - } - - return ""; -} - -function getLayoutedMessage($msgbuffer = "", $sigID = "", $showpart = 0, $ctype = 0){ - - if ($msgbuffer == "") { - return 'An error occured while parsing the message (no message).'; - } - if ($sigID == "") { - return 'An error occured while parsing the message (no signature).'; - } - - if( extension_loaded( 'mailparse' ) ) { - $msgdate = "N/A"; - $msgfrom = "N/A"; - $msgsub = "N/A"; - $msgto = "N/A"; - - $mime = mailparse_msg_create(); - mailparse_msg_parse($mime, $msgbuffer); - /* return an array of message parts - this contsists of the - * names of the parts only. - */ - $struct = mailparse_msg_get_structure($mime); - $htmlstr = << - Message Infos - - - Date: - %MSGDATE% - - - From: - %MSGFROM% - - - Subject: - %MSGSUB% - - - To: - %MSGTO% - - -   - - - Message Part - Part Type - Part Encoding - - - -EOD; - - /* print a choice of sections */ - foreach($struct as $st) { - - /* get a handle on the message resource for a subsection */ - $section = mailparse_msg_get_part($mime, $st); - /* get content-type, encoding and header information for that section */ - $info = mailparse_msg_get_part_data($section); - - /* replace placeholder with real data */ - if ($info['headers']['date'] <> "") { - $htmlstr = str_replace("%MSGDATE%", $info['headers']['date'], $htmlstr); - } - if ($info['headers']['from'] <> "") { - $htmlstr = str_replace("%MSGFROM%", $info['headers']['from'], $htmlstr); - } - if ($info['headers']['subject'] <> "") { - $htmlstr = str_replace("%MSGSUB%", $info['headers']['subject'], $htmlstr); - } - if ($info['headers']['to'] <> "") { - $htmlstr = str_replace("%MSGTO%", $info['headers']['to'], $htmlstr); - } - - $fontStyle = ""; - if ($showpart && $showpart == $st) { $fontStyle = " style=\"font-weight: bolder;\""; } - - if ($info["content-type"] == "text/html") { - $htmlstr .= "" . - "{$st}" . - "\n"; - } else { - $htmlstr .= "" . - "{$st}" . - "\n"; - } - - $htmlstr .= <<{$info["content-type"]} - {$info["charset"]} - - -EOD; - } // end foreach - - /* if we were called to display a part, do so now */ - if ($showpart) { - /* get a handle on the message resource for the desired part */ - $sec = mailparse_msg_get_part($mime, $showpart); - - $htmlstr .= << -   - - - Section {$showpart} - - - -EOD; - - ob_start(); - mailparse_msg_extract_part($sec, $msgbuffer); - $contents = ob_get_contents(); - ob_end_clean(); - $contents = wordwrap( str_replace(">", ">\n", $contents), 100, "\n" ); - /* quote the message for safe display in a browser */ - if ($ctype = 1) { - /* a html email message */ - $htmlstr .= "
" . $contents . "
\n\n"; - } else { - /* an ASCII (text) email message */ - $htmlstr .= htmlentities($contents) . "\n\n"; - } - } - - return $htmlstr; - } else { - return 'Could not load mailparse extension.'; - } -} - -function &QuarantineViewMessage($sigID = "", - $showpart = 0, - $ctype = 0, - $sortBy = "Rating", - $currentPage = 1, - $qPerPage = 0) { - global $MAILBOX, $DATA; - $buffer = array(); // mailbox buffer - - if ($sigID == "") { - return $input_errors[] = "No Message ID Specified."; - } - - /* save data to be displayed as HTML form data */ - $DATA['MESSAGE_ID'] = $sigID; - $DATA['SHOWPART'] = $showpart; - $DATA['CONTENT_TYPE'] = $ctype; - $DATA['QPAGE'] = $currentPage; - $DATA['SORTBY'] = $sortBy; - - if ($qPerPage > 0) { $CONFIG['QUARANTINE_PER_PAGE'] = $qPerPage; } - - /* read the user's mailbox line by line into a buffer */ - $fd = fopen("{$MAILBOX}", "r"); - while (!feof($fd)) { - $line = chop(fgets($fd, 4096)); - array_push($buffer, $line); - } - fclose ($fd); - - /* iterate over the mailbox buffer */ - reset($buffer); - $i = 0; - while ($i < count($buffer)) { - $temp = array(); - $head = array(); - $mode = 0; - $buff = ""; - - /* this while tries to iterate over one single mesage including - * the message header and the message body. - */ - while((preg_match('/^From /', $buff) == 0) && ($i < count($buffer))) { - $buff = $buffer[0]; - - /* switch mode if we are hitting DSPAMs - * pseudo From QUARANTINE line (without a - * colon after the From). - */ - if (preg_match('/^From /', $buff) > 0) { - if ($mode == 0) { $mode = 1; } - else { continue; } - } - - $buff = array_shift($buffer); - if (preg_match('/^From /', $buff) == 0) { - array_push($temp, $buff); - } - - continue; - } - - /* populate the header array with header fields */ - foreach($temp as $tempel) { - if ($tempel == "") { break; } - list($key, $val) = preg_split('/\: ?/', $tempel, 2); - $head[$key] = $val; - } - if ($head['X-DSPAM-Signature'] == $sigID) { - foreach($temp as $tempel) { - $tempel = preg_replace("//e", "'>'", $tempel); - $DATA['MESSAGE'] .= "{$tempel}\n"; - } - } - - $i ++; - } // end while -} - -function QuarantineDeleteSpam($deleteAll = "", $signatures = array(), $sortBy = "Rating", $currentPage = 1, $qPerPage = 0){ - global $USER, $MAILBOX; - $buffer = array(); - - /* this is the most easiest operation: If the user wants - * to completly delete any quarantined message, simply - * open his mailbox in write mode, which empties the - * user's mailbox file. - */ - if ($deleteAll <> "") { - - list($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, - $atime,$mtime,$ctime,$blksize,$blocks) = stat("{$USER}.mbox"); - - $fd = fopen("{$USER}.mbox.size", "r"); - $sz = chop(fgets($fd, 4096)); - fclose($fd); - - if ($sz == $size) { - $fd = fopen("{$MAILBOX}", "w"); - fclose($fd); - unlink("{$USER}.mbox.size"); - unlink("{$USER}.mboxwarn"); - } else { - return DisplayQuarantine($sortBy, $currentPage, $qPerPage); - } - - //$FORM{'template'} = "performance"; - CheckQuarantine(); - return DisplayIndex(); - } - - /* iterate over the user's mailbox and store its contents in a buffer */ - $fd = fopen("{$MAILBOX}", "r"); - while (!feof($fd)) { - $line = chop(fgets($fd, 4096)); - array_push($buffer, $line); - } - fclose($fd); - - /* open the user's mailbox in write mode. This empties the mailbox! */ - fopen("{$MAILBOX}", "w"); - - /* iterate over the mailbox buffer */ - reset($buffer); - $i = 0; - while ($i < count($buffer)) { - $temp = array(); - $head = array(); - $mode = 0; - - /* this while tries to iterate over one single mesage including - * the message header and the message body. - */ - while((preg_match('/^From /', $buff) == 0) && ($i < count($buffer))) { - $buff = $buffer[0]; - - /* switch mode if we are hitting DSPAMs - * pseude From QUARANTINE line (without a - * colon after the From). - */ - if (preg_match('/^From /', $buff) > 0) { - if ($mode == 0) { - $mode = 1; - $buff = array_shift($buffer); - array_push($temp, $buff); - $buff = ""; - continue; - } else { - continue; - } - } - $buff = array_shift($buffer); - array_push($temp, $buff); - - continue; - } - - /* populate the header array with header fields */ - foreach($temp as $tempel) { - if ($tempel == "") { break; } - list($key, $val) = preg_split('/\: ?/', $tempel, 2); - $head[$key] = $val; - } - - /* if the current DSPAM signature wasn't selected by the - * user to be deleted, write it back to the user's mailbox. - */ - if ($signatures["chkmsg-{$head['X-DSPAM-Signature']}"] == "") { - foreach($temp as $tempel) { - fwrite($fd, "{$tempel}\n"); - } - } - - $i++; - } // end while - fclose($fd); - - return; -} - -function sortBySubject($a, $b){ - $lca = strtolower ($a['Subject']); - $lcb = strtolower ($b['Subject']); - - return strcmp($lca, $lcb); -} - -function sortByFrom($a, $b){ - $lca = strtolower ($a['From']); - $lcb = strtolower ($b['From']); - - return strcmp($lca, $lcb); -} - -function &DisplayQuarantine($sortBy = "Rating", $currentPage = 1, $qPerPage = 0) { - global $USER, $CURRENT_USER, $CONFIG, $DATA, $MAILBOX; - $alertcfg = &$config['installedpackages']['dspamalerts']['config']; - $alerts = array(); - - if (file_exists("{$USER}.mbox")) { - list($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, - $atime,$mtime,$ctime,$blksize,$blocks) = stat("{$USER}.mbox"); - - $fd = fopen("{$USER}.mbox.size", "w"); - fwrite($fd, "{$size}"); - fclose($fd); - - $fd = fopen("{$MAILBOX}.stamp", "a+"); - fclose($fd); - chmod("{$MAILBOX}.stamp", 0660); - - /* process alert names */ - if (is_array($alertcfg)) { - $alert_counter = 0; - - foreach ($alertcfg as $alert) { - $alerts[$alert_counter] = $alert['alertname']; - $alert_counter++; - } - } - - $mode = ""; - $buffer = array(); - $headings = array(); - $rowclass = "qrowEven"; - $fd = fopen("{$MAILBOX}", "r"); - - while (!feof($fd)) { - $mbxline = chop(fgets($fd, 4096)); - - if ($mbxline <> "") { - if (($mode == "")) { - if (preg_match('/^From /', $mbxline) > 0) { - $mode = 1; - } else { - continue; - } - } - - array_push($buffer, $mbxline); - continue; - } - - if ($mode == "") { continue; } - - $alert = 0; - $new = array(); - - foreach($buffer as $buf_element){ - foreach($alerts as $al){ - if (preg_match("/{$al}/i", $buf_element) > 0) { - $alert = 1; - } - } - - if (preg_match('/^From /', $buf_element) > 0) { - $a = split(' ', $buf_element); - $x = 2; - - for ($i = 0; $i < count ($a); $i++) { - if ((preg_match('/\@|>/', $a[$i]) > 0) && $i > $x) { - $x = $i + 1; - } - } - - for ($i = 1; $i < $x; $i++) { array_shift($a); } - $start = join(" ", $a); - } else { - list($key, $val) = preg_split('/\: ?/', $buf_element, 2); - $new[$key] = $val; - } - } - - if ($rowclass == "qrowEven") { - $rowclass = "qrowOdd"; - } else { - $rowclass = "qrowEven"; - } - - $new['alert'] = $alert; - - if ($alert) { $rowclass="qrowAlert"; } - - $new['Sub2'] = $new['X-DSPAM-Signature']; - if (strlen($new['Subject']) > $CONFIG['MAX_COL_LEN']) { - $new['Subject'] = substr($new['Subject'], 0, $CONFIG['MAX_COL_LEN']) . "..."; - } - - if (strlen($new['From']) > $CONFIG['MAX_COL_LEN']) { - $new['From'] = substr($new['From'], 0, $CONFIG['MAX_COL_LEN']) . "..."; - } - - if ($new['Subject'] == "") { - $new['Subject'] = ""; - } - - //$new->{'rating'} = $new->{'X-DSPAM-Probability'} * $new->{'X-DSPAM-Confidence'}; - $new['rating'] = $new['X-DSPAM-Confidence']; - - foreach(array_keys($new) as $key) { - if ($key == "X-DSPAM-Signature") { continue; } - preg_replace('//', '/\>\;/', $new[$key]); - } - - array_push($headings, $new); - - $buffer = array(); - $mode = ""; - continue; - } // end while (!feof($fd)) - - if (! isset($sortBy) || $sortBy == "") { - $sortBy = $CONFIG['SORT_DEFAULT']; - } - if ($sortBy == "Rating") { - usort($headings, "sortByRating"); - } - if ($sortBy == "Subject") { - usort($headings, "sortBySubject"); - } - if ($sortBy == "From") { - usort($headings, "sortByFrom"); - } - if ($sortBy == "Date") { - array_reverse ($headings); - } - - /* - - -   - Rating - Date - From - Subject - - - */ - - $DATA['SORTBY'] = $sortBy; - $DATA['SORT_SELECTOR'] .= << -   - -EOD; - - if ($sortBy == "Rating") { - $DATA{'SORT_SELECTOR'} .= "Rating  ◊"; - } else { - $DATA{'SORT_SELECTOR'} .= "Rating"; - } - if ($sortBy == "Date") { - $DATA{'SORT_SELECTOR'} .= "Date  ◊"; - } else { - $DATA{'SORT_SELECTOR'} .= "Date"; - } - if ($sortBy == "Subject") { - $DATA{'SORT_SELECTOR'} .= "Subject  ◊"; - } else { - $DATA{'SORT_SELECTOR'} .= "Subject"; - } - if ($sortBy == "From") { - $DATA{'SORT_SELECTOR'} .= "From  ◊"; - } else { - $DATA{'SORT_SELECTOR'} .= "From"; - } - - $DATA{'SORT_SELECTOR'} .= "\n "; - - if (isset($qPerPage) && $qPerPage > 0) { - $CONFIG['QUARANTINE_PER_PAGE'] = $qPerPage; - } - - if (isset($currentPage) && isset($CONFIG['QUARANTINE_PER_PAGE'])) { - $pages = ceil( (count ($headings) / $CONFIG['QUARANTINE_PER_PAGE']) ); - $begin = (($currentPage - 1) * $CONFIG['QUARANTINE_PER_PAGE']); - $ranges = ceil ($pages / $CONFIG['QNAV_BUTTONS']); - - /* Now lets just keep the information that we really need. */ - $headings = array_splice ($headings, $begin, $CONFIG['QUARANTINE_PER_PAGE']); - } - - $rowclass = "qrowEven"; - foreach ($headings as $row) { - $rating = sprintf("%3.0f%%", $row['rating'] * 100.0); - if ($row['rating'] > 0.8) { - $markclass = "high"; - } else { - if ($row['rating'] < 0.7) { - $markclass = "low"; - } else { - $markclass = "medium"; - } - } - - $PAIRS = array(); - - $PAIRS['signatureID'] = $row['X-DSPAM-Signature']; - $PAIRS['command'] = "viewMessage"; - $PAIRS['user'] = $CURRENT_USER; - $PAIRS['page'] = $currentPage; - $PAIRS['sortby'] = $sortBy; - $PAIRS['qperpage'] = $CONFIG['QUARANTINE_PER_PAGE']; - // $PAIRS['template'] = "quarantine"; - - $url = SafeVars($PAIRS); - $sender = htmlentities ($row['From']); - $rsubject = htmlentities ($row['Subject']); - - if ($row['alert']) { - $outclass = "qrowAlert"; - } else { - $outclass = $rowclass; - } - - $ptfields = preg_split('/\s+/', $row['X-DSPAM-Processed']); - $times = preg_split('/\:/', $ptfields[3]); - $ptime = ""; - if($CONFIG["DATE_FORMAT"]) { - $month = array(); - $month['Jan'] = 0; - $month['Feb'] = 1; - $month['Mar'] = 2; - $month['Apr'] = 3; - $month['May'] = 4; - $month['Jun'] = 5; - $month['Jul'] = 6; - $month['Aug'] = 7; - $month['Sep'] = 8; - $month['Oct'] = 9; - $month['Nov'] = 10; - $month['Dec'] = 11; - $ptime = strftime($CONFIG["DATE_FORMAT"], - mktime($times[2], - $times[1], - $times[0], - $ptfields[2], - $month[$ptfields[1]], - $ptfields[4] - 1900)); - } else { - $mer = "a"; - if ($times[0] > 12) { $times[0] -= 12; $mer = "p"; } - if ($times[0] == 0) { $times[0] = "12"; } - $ptime = "{$ptfields[1]} {$ptfields[2]} {$times[0]}:{$times[1]}{$mer}"; - } - - /* - - - - - - - 50% - - Apr 1 05:59a - Mar 30 11:08a - - Last chance to register for Frankfurt, 4 April BEA... - - - - - - - - - {$rating} - - {$ptime} - {$row['From']} - - {$row['Subject']} - - - */ - - $DATA['QUARANTINE'] .= << - - - - - {$rating} - - {$ptime} - {$sender} - - {$rsubject} - - - -EOD; - - if ($rowclass == "qrowEven") { - $rowclass = "qrowOdd"; - } else { - $rowclass = "qrowEven"; - } - } // end foreach ($headings as $row) - - /* prepare quarantine navbar */ - if (($currentPage - 1) >= 1) { $previousPage = $currentPage - 1; } - else { $previousPage = 1; } - - if (($currentPage + 1) <= $pages) { $nextPage = $currentPage + 1; } - else { $nextPage = $pages; } - - $quarantineFooterBegin = << - - - - - - |<  - <  - -EOD; - - $quarantineFooterEnd = <<>  - >| - - - -EOD; - - $ranges_array = array(); - $rpages = $pages; - for ($i = 0; $i < $ranges; $i++) { - $range = array(); - $range['start'] = (($i + 1)* $CONFIG['QNAV_BUTTONS']) - ($CONFIG['QNAV_BUTTONS'] - 1); - - if (($i + 1) == $ranges) { - $range['end'] = ($range['start'] + $rpages) - 1; - } else { - $range['end'] = (($i + 1)* $CONFIG['QNAV_BUTTONS']); - $rpages -= $CONFIG['QNAV_BUTTONS']; - } - - $ranges_array[$i] = $range; - } - - /* generate nav buttons */ - foreach($ranges_array as $range){ - if ($currentPage >= $range['start'] && $currentPage <= $range['end']) { - for ($i = $range['start']; ; $i++) { - if ($i > $range['end']) { - break; - } else { - if ($i == $currentPage) { - $quarantineFooter .= "{$i} \n"; - } else { - $quarantineFooter .= "{$i} \n"; - } - } - } - } - } - - $DATA['QUARANTINE_FOOTER'] = $quarantineFooterBegin . $quarantineFooter .$quarantineFooterEnd; - $DATA['QPAGES'] = $pages; - $DATA['QPAGE'] = $currentPage; - } else { - $input_errors[] = "Unable to open DSPAM quarantine mailbox at »{$USER}.mbox«. " . - "If you are a DSPAM admin user you can savely " . - "ignore this error because such users usually do not " . - "have a DSPAM mailbox/quarantine."; - } - - return $input_errors; -} - -/* ========================================================================== */ -/* = P E R F O R M A N C E F U N C T I O N S = */ -/* ========================================================================== */ - -function ResetStats() { - global $USER; - - $fd = fopen("{$USER}.stats", "r"); - $ts = chop(fgets($fd, 4096)); - $group = chop(fgets($fd, 4096)); - fclose($fd); - list($ts, $ti, $tm, $fp, $sc, $ic) = split(",", $ts); - - if ($group <> "") { - $GROUP = GetPath($group) . ".stats"; - $fd = fopen("{$GROUP}", "r"); - $gts = chop(fgets($fd, 4096)); - fclose($fd); - list ($gts, $gti, $gtm, $gfp, $gsc, $gic) = split(",", $gts); - $ts -= $gts; - $ti -= $gti; - $tm -= $gtm; - $fp -= $gfp; - $sc -= $gsc; - $ic -= $gic; - } - - $fd = fopen("{$USER}.rstats", "w"); - fputs($fd, "{$ts}" . "," . "{$ti}" . "," . "{$tm}" . "," . - "{$fp}" . "," . "{$sc}" . "," . "{$ic}\n"); - fclose($fd); -} - -function Tweak() { - global $USER; - - $fd = fopen("{$USER}.rstats", "r"); - $ts = chop(fgets($fd, 4096)); - $group = chop($fgets($fd, 4096)); - fclose($fd); - list($ts, $ti, $tm, $fp, $sc, $ic) = split(",", $ts); - $tm++; - - $fd = fopen("{$USER}.rstats", "w"); - fputs($fd, "{$ts},{$ti},{$tm},{$fp},{$sc},{$ic}\n"); - fclose($fd); -} - -function &DisplayIndex() { - global $USER, $CONFIG, $DATA, $CURRENT_STORE, $CURRENT_USER; - - if (strpos ($CURRENT_USER, "@") === false) { - if (GetDomain($CURRENT_STORE) <> "") - $domain = GetDomain($CURRENT_STORE); - else - $domain = $config['system']['domain']; - - $spamalias = "spam-{$CURRENT_USER}@{$domain}"; - } else { - $spamalias = "spam-{$CURRENT_USER}"; - } - - if ($handle = @fopen ("{$USER}.stats", "r")) { - $spam .= chop(fgets($handle, 4096)); - $group .= chop(fgets($handle, 4096)); - fclose($handle); - list($spam, $innocent, $misses, $fp, $sc, $ic) = split(",", $spam); - - if ($group <> "") { - $GROUP = GetPath($group) . ".stats"; - $fd = fopen("{$GROUP}", "r"); - $gspam = chop(fgets($fd, 4096)); - fclose($fd); - - list($gspam, $ginnocent, $gfp, $gmisses, $gsc, $gic) = preg_split('/\,/', $gspam); - $spam -= $gspam; - $innocent -= $ginnocent; - $misses -= $gmisses; - $fp -= $gfp; - $sc -= $gsc; - $ic -= $gic; - } - - if ($spam + $innocent > 0) { - $ratio = sprintf("%2.3f", - (($spam+$misses)/($spam+$misses+$fp+$innocent)*100)); - } else { - $ratio = 0; - } - - if (file_exists("{$USER}.rstats")) { - $handle = fopen ("{$USER}.rstats", "r"); - $buffer = chop(fgets($handle, 4096)); - - fclose ($handle); - - list($rts, $rti, $rtm, $rfp) = split(",", $buffer); - - $real_missed = $misses - $rtm; - $real_caught = $spam - $rts; - $real_fp = $fp - $rfp; - - if ($real_fp < 0) { $real_fp = 0; } - - $real_innocent = $innocent - $rti; - - if (($spam - $rts > 0) && ($spam - $rts + $misses - $rtm != 0) && - ($real_caught + $real_missed > 0) && ($real_fp + $real_innocent > 0)) { - $monthly = sprintf("%2.3f", - (100.0-(($real_missed)/($real_caught+$real_missed))*100.0)); - $overall = sprintf("%2.3f", - (100-((($real_missed+$real_fp) / - ($real_fp+$real_innocent+$real_caught+$real_missed))*100))); - } else { - if ($real_caught == 0 && $real_missed > 0) { - $monthly = 0; - $overall = 0; - } else { - $monthly = 100; - $overall = 100; - } - } - - if ($real_fp + $real_innocent > 0) { - $fpratio = sprintf("%2.3f", ($real_fp/($real_fp+$real_innocent)*100)); - } else { - $fpratio = 0; - } - - } else { - $rts = $spam + $misses; - $rti = $innocent; - $rtm = $misses; - $rfp = $fp; - - $handle = fopen ("{$USER}.rstats", "w"); - fwrite("{$rts},{$rti},{$rtm},{$rfp}\n"); - fclose($handle); - - $monthly = "N/A"; - $fpratio = "N/A"; - $overall = "N/A"; - } - - $DATA['TIME'] = $time; - $DATA['TOTAL_SPAM_SCANNED'] = $spam; - $DATA['TOTAL_SPAM_LEARNED'] = $misses; - $DATA['TOTAL_NONSPAM_SCANNED'] = $innocent; - $DATA['TOTAL_NONSPAM_LEARNED'] = $fp; - $DATA['SPAM_RATIO'] = $ratio; - $DATA['SPAM_ACCURACY'] = $monthly; - $DATA['NONSPAM_ERROR_RATE'] = $fpratio; - $DATA['OVERALL_ACCURACY'] = $overall; - $DATA['TOTAL_SPAM_CORPUSFED'] = $sc; - $DATA['TOTAL_NONSPAM_CORPUSFED'] = $ic; - $DATA['TOTAL_SPAM_MISSED'] = $real_missed; - $DATA['TOTAL_SPAM_CAUGHT'] = $real_caught; - $DATA['TOTAL_NONSPAM_MISSED'] = $real_fp; - $DATA['TOTAL_NONSPAM_CAUGHT'] = $real_innocent; - $DATA['SPAM_ALIAS'] = $spamalias; - - $DATA['LOCAL_DOMAIN'] = $CONFIG['LOCAL_DOMAIN']; - } else { - $DATA['SPAM_ACCURACY'] = "N/A"; - $DATA['NONSPAM_ERROR_RATE'] = "N/A"; - $DATA['OVERALL_ACCURACY'] = "N/A"; - $DATA['SPAM_RATIO'] = "N/A"; - $DATA['TOTAL_SPAM_MISSED'] = 0; - $DATA['TOTAL_SPAM_CAUGHT'] = 0; - $DATA['SPAM_RATIO'] = "N/A"; - $DATA['TOTAL_NONSPAM_MISSED'] = 0; - $DATA['TOTAL_NONSPAM_CAUGHT'] = 0; - $DATA['NONSPAM_ERROR_RATE'] = "N/A"; - $DATA['TOTAL_SPAM_LEARNED'] = 0; - $DATA['TOTAL_SPAM_SCANNED'] = 0; - $DATA['TOTAL_NONSPAM_LEARNED'] = 0; - $DATA['TOTAL_NONSPAM_SCANNED'] = 0; - $DATA['TOTAL_SPAM_CORPUSFED'] = 0; - $DATA['TOTAL_NONSPAM_CORPUSFED'] = 0; - $DATA['SPAM_ALIAS'] = $spamalias; - - $input_errors[] = "Unable to open DSPAM stats at »{$USER}.stats«. " . - "If you are a DSPAM admin user you can savely " . - "ignore this error because such users usually do not " . - "have a DSPAM mailbox/quarantine."; - } - - return $input_errors; -} - -function getJScriptFunction($whichOne = 0) { - $changeuser_msg = gettext("Do you realy want to change the current user?") . "\\n" . - gettext("This requires a logout followed by a login."); - - switch ($whichOne) { - case 0: - $scriptstr = ' - - /* applicable for almost any dspam related page */ - function changeuser() { - check = confirm("' . $changeuser_msg . '"); - - if (check == true) - window.location.href = "/index.php?logout=true"; - } - '; - - break; - case 1: - $scriptstr = ' - - /* applicable for dspam-quarantine.php */ - function checkallmsgs(enable) { - var endis = (document.iform.checkall.checked || enable); - var elem = document.iform.elements.length; - - for (i = 0; i < elem; i++) { - if (document.iform.elements[i].name.indexOf("chkmsg") >= 0) { - document.iform.elements[i].checked = endis; - } - } - } - '; - - break; - case 2: - $scriptstr = ' - - /* applicable for dspam-quarantine.php */ - function sortmsg(criterion) { - var baseURL = "/dspam-quarantine.php?page=" + document.iform.qpage.value; - var qperpage = document.getElementsByName("qperpage")[0].value; - - window.location.href = baseURL + "&qperpage=" + qperpage + "&sortby=" + criterion; - } - '; - - break; - case 3: - $scriptstr = ' - - /* applicable for dspam-quarantine.php */ - function processmsg(what) { - var elem = document.iform.elements.length; - var checked = false; - - switch (what) { - case 0: - for (i = 0; i < elem; i++) { - if (document.iform.elements[i].name.indexOf("chkmsg") >= 0 && - document.iform.elements[i].checked == true) { - checked = true; - break; - } - } - - if (checked) { - document.iform.processAction.value = "manyNotSpam"; - } else { - alert("You did not select any message that should be processed as not beeing Spam."); - return false; - } - break; - case 1: - for (i = 0; i < elem; i++) { - if (document.iform.elements[i].name.indexOf("chkmsg") >= 0 && - document.iform.elements[i].checked == true) { - checked = true; - break; - } - } - - if (checked) { - if (confirm("Are you sure you want to delete SELECTED messages in quarantine?") == false) { - return false; - } else { - document.iform.processAction.value = "manySpam"; - } - } else { - alert("You did not select any message that should be processed as beeing Spam."); - return false; - } - break; - case 2: - if (confirm("Are you sure you want to delete ALL messages in quarantine?") == false) { - return false; - } else { - document.iform.processAction.value = "deleteAll"; - } - break; - } - - document.iform.submit(); - } - '; - - break; - case 4: - $scriptstr = ' - - /* applicable for dspam-quarantine.php nad dspam-history.php */ - function changeQPerPage(originator) { - var elementName = ""; - var baseURL = ""; - - if (originator.name == "qperpage") { - baseURL = "/dspam-quarantine.php?page=" + document.iform.qpage.value; - elementName = "qperpage"; - } else { - baseURL = "/dspam-history.php?page=" + document.iform.hpage.value; - elementName = "hperpage"; - } - - for (var i = 0; i < 2; i++) { - document.getElementsByName(elementName)[i].value = originator.value; - } - - if (originator.name == "qperpage") - window.location.href = baseURL + "&qperpage=" + originator.value; - else - window.location.href = baseURL + "&hperpage=" + originator.value; - } - '; - - break; - case 5: - $scriptstr = ' - - /* applicable for dspam-settings.php */ - - function fadeTableRow(rowid, fadeType, opts){ - if(!opts){ - opts = {}; - } - - var row = $(rowid); - var cells= row.childNodes; - for(i=0;i diff --git a/packages/dspam/pkg/dspam-pkgfunc.inc b/packages/dspam/pkg/dspam-pkgfunc.inc deleted file mode 100644 index 31a7fa06..00000000 --- a/packages/dspam/pkg/dspam-pkgfunc.inc +++ /dev/null @@ -1,548 +0,0 @@ - "dspam.sh", - "start" => $start, - "stop" => $stop - ) - ); - conf_mount_ro(); - config_unlock(); - - if (! file_exists("/usr/local/etc/dspam.conf")) { - mwexec("ln -s /etc/dspam.conf /usr/local/etc/dspam.conf"); - } - - mwexec("/usr/local/etc/rc.d/dspam.sh stop"); - mwexec("/usr/local/etc/rc.d/dspam.sh start"); - - return 0; -} - -function dspam_configure() { - global $config, $g; - - $dspamcfg = $config['installedpackages']['dspam']['config'][0]; - - if ($g['booting']) - echo "Starting DSPAM service... "; - else - sleep(1); - - /* write dhcpd.conf */ - $fd = fopen("/usr/local/etc/dspam.conf", "w"); - if (!$fd) { - printf("Error: cannot open dhcpd.conf in services_dhcpd_configure().\n"); - return 1; - } - - $dspamconf = << 0) { - $dspamconf .= "Algorithm\t\t"; - - foreach ($t_algos as $algo) { - $dspamconf .= "{$algo['name']} "; - } - - $dspamconf .= "\n"; - } - - $dspamconf .= "PValue\t\t\t{$dspamcfg['pvalue']}\n"; - isset($dspamcfg['improbability-drive']) ? $dspamconf .= "ImprobabilityDrive\ton\n" : $dspamconf .= "ImprobabilityDrive\toff\n"; - - $t_prefs = &$dspamcfg['preference']; - - foreach ($t_prefs as $pref) { - $dspamconf .= "Preference\t\t{$pref['value']}\n"; - } - - $t_overr = &$dspamcfg['override']; - - foreach ($t_overr as $over) { - $dspamconf .= "AllowOverride\t\t{$over['value']}\n"; - } - - if (isset($dspamcfg['ldap-enable'])) { - $dspamconf .= << "") { - $dspamconf .= << "") { - $dspamconf .= "ClientPort\t\t{$dspamcfg['dspam-client-port']}\n"; - } - } - - $dspamconf .= "## EOF\n"; - - fwrite($fd, $dspamconf); - fclose($fd); - - /* fire up dspam --daemon */ - mwexec("/usr/local/etc/rc.d/dspam.sh stop"); - mwexec("/usr/local/etc/rc.d/dspam.sh start"); - - if ($g['booting']) { - print "done.\n"; - } - - return 0; -} - -function custom_php_install_command() { - global $config, $g; - /* create a default config */ - sync_package_dspam(); -} - -function custom_php_deinstall_command() { - global $config, $g; - conf_mount_rw(); - unlink_if_exists("/usr/local/etc/rc.d/dspam.sh"); - unlink_if_exists("/usr/local/etc/dspam.conf"); - unlink_if_exists("/usr/local/bin/dspam_spamfeed"); - unlink_if_exists("/usr/local/bin/dspam_innocentfeed"); - conf_mount_ro(); -} - -function checkForLDAPSupport() { - $pd = popen("ldd /usr/local/bin/dspam", "r"); - while (!feof($pd)) { - $dspamstr .= fgets($pd, 4096); - } - pclose($pd); - - if (strpos($dspamstr, "libldap") !== false && - file_exists("/usr/local/lib/libldap.so") && - file_exists("/usr/local/lib/liblber.so")) { - return true; - } - - return false; -} - -function checkForPgSQLSupport() { - if (file_exists("/usr/local/lib/libpgsql_drv.so") && - file_exists("/usr/local/lib/libpq.so")) { - return true; - } - - return false; -} - -function checkForMySQLSupport() { - if (file_exists("/usr/local/lib/libmysql_drv.so") && - file_exists("/usr/local/lib/mysql/libmysqlclient.so")) { - return true; - } - - return false; -} - -function checkForSQLiteSupport() { - if (file_exists("/usr/local/lib/libsqlite3_drv.so") && - file_exists("/usr/local/lib/mysql/libsqlite3.so")) { - return true; - } - - return false; -} - -function checkForClamAVSupport() { - if (file_exists("/usr/local/bin/clamdscan") && - file_exists("/usr/local/bin/clamscan") && - file_exists("/usr/local/sbin/clamd")) { - return true; - } - - return false; -} - -?> diff --git a/packages/dspam/pkg/dspam-utilfunc.inc b/packages/dspam/pkg/dspam-utilfunc.inc deleted file mode 100644 index 903790b8..00000000 --- a/packages/dspam/pkg/dspam-utilfunc.inc +++ /dev/null @@ -1,458 +0,0 @@ - $value ) { - if( is_array( $value ) ){ - $new_convention = sprintf( $convention, $key ) . '[%s]'; - $query .= http_parse_query( $value, $new_convention ); - } else { - $key = urlencode( $key ); - $value = urlencode( $value ); - $query .= sprintf( $convention, $key ) . "=$value&"; - } - } - } - - return $query; - } -} - -/* just a wrapper function */ -function SafeVars($PAIRS) { - $url = http_parse_query($PAIRS); - return $url; -} - -function To12Hour($h) { - if ($h < 0) { $h += 24; } - if ($h > 11) { if ($h > 12) { $h -= 12; } $h .= "p"; } - else { if ($h == 0) { $h = "12"; } $h .= "a"; } - return $h; -} - -function GetPath($store) { - global $CONFIG, $USER; - $PATH = ""; - - /* Domain-scalen */ - if ($CONFIG['DOMAIN_SCALE'] == 1) { - $splittmp = (split('@', $store)); - $VPOPUSERNAME = $splittmp[0]; - $VPOPDOMAIN = $splittmp[1]; - if ($VPOPDOMAIN == "") {$VPOPDOMAIN = "local";} - - $PATH = "{$CONFIG['DSPAM_HOME']}/data/{$VPOPDOMAIN}/{$VPOPUSERNAME}/" . - "{$VPOPUSERNAME}"; - return $PATH; - - /* Normal scale */ - } else if ($CONFIG['LARGE_SCALE'] == 0) { - $PATH = "{$CONFIG['DSPAM_HOME']}/data/{$USER}/{$USER}"; - return $PATH; - - /* Large-scale */ - } else { - if (strlen($USER) > 1) { - $PATH = "{$CONFIG['DSPAM_HOME']}/data/" . substr($USER, 0, 1) . - "/". substr($USER, 1, 1) . "/{$USER}/{$USER}"; - } else { - $PATH = "{$CONFIG['DSPAM_HOME']}/data/{$USER}/{$USER}"; - } - return $PATH; - } -} - -function GetUserDir($store) { - global $CONFIG, $USER; - $PATH = ""; - - /* Domain-scalen */ - if ($CONFIG['DOMAIN_SCALE'] == 1) { - $splittmp = (split('@', $store)); - $VPOPUSERNAME = $splittmp[0]; - $VPOPDOMAIN = $splittmp[1]; - if ($VPOPDOMAIN == "") {$VPOPDOMAIN = "local";} - - $PATH = "{$CONFIG['DSPAM_HOME']}/data/{$VPOPDOMAIN}/{$VPOPUSERNAME}"; - return $PATH; - - /* Normal scale */ - } else if ($CONFIG['LARGE_SCALE'] == 0) { - $PATH = "{$CONFIG['DSPAM_HOME']}/data/{$USER}/"; - return $PATH; - - /* Large-scale */ - } else { - if (strlen($USER) > 1) { - $PATH = "{$CONFIG['DSPAM_HOME']}/data/" . substr($USER, 0, 1) . - "/". substr($USER, 1, 1) . "/{$USER}/{$USER}"; - } else { - $PATH = "{$CONFIG['DSPAM_HOME']}/data/{$USER}"; - } - return $PATH; - } -} - -function GetDomain($store) { - global $CONFIG, $USER; - $PATH = ""; - - /* Domain-scalen */ - if ($CONFIG['DOMAIN_SCALE'] == 1) { - $splittmp = (split('@', $store)); - $VPOPUSERNAME = $splittmp[0]; - $VPOPDOMAIN = $splittmp[1]; - if ($VPOPDOMAIN == "") {$VPOPDOMAIN = "local";} - - return $VPOPDOMAIN; - } -} - -function isDSPAMAdmin($username = "") { - global $config, $CONFIG; - - $groupindex = index_groups(); - $userindex = index_users(); - - if ($username == "") { return 0; } - - $gname = $config['system']['group'][$groupindex[$config['system']['user'][$userindex[$username]]['groupname']]]['name']; - - if (isset($gname)) { - return ($gname === $CONFIG['DSPAM_ADMIN_GROUP']); - } - - return 0; -} - -function createUserNotificationMessages() { - global $config, $CONFIG, $USER, $CURRENT_USER, $CURRENT_STORE; - - $firstrun = "{$USER}.firstrun"; - $firstspam = "{$USER}.firstspam"; - $quarantinefull = "{$USER}.quarantinefull"; - $savemsg = ""; - - if (isset($config['installedpackages']['dspam']['config'][0]['dspam-domain'])) - $domain = $config['installedpackages']['dspam']['config'][0]['dspam-domain']; - else - $domain = $config['system']['domain']; - - if (GetDomain($CURRENT_STORE) <> "") - $user_domain = GetDomain($CURRENT_STORE); - else - $user_domain = $config['system']['domain']; - - $userdir = GetUserDir($CURRENT_STORE); - $hostname = $config['system']['hostname']; - $support_user = $config['installedpackages']['dspam']['config'][0]['dspam-contact']; - - /* return if there are no sample files */ - if (! file_exists("{$CONFIG['DSPAM_HOME']}/firstrun.txt.sample") || - ! file_exists("{$CONFIG['DSPAM_HOME']}/firstspam.txt.sample") || - ! file_exists("{$CONFIG['DSPAM_HOME']}/quarantinefull.txt.sample") || - ! file_exists($userdir)) { - return; - } - - /* create firstrun.txt */ - if (! file_exists("{$firstrun}")) { - $sample_msg = file_get_contents("{$CONFIG['DSPAM_HOME']}/firstrun.txt.sample"); - - $sample_msg = str_replace("support", $support_user, $sample_msg); - $sample_msg = str_replace("configureme.com", $user_domain, $sample_msg); - $sample_msg = str_replace("http://www.yourdomain.com/dspam/", - "http://{$hostname}.{$domain}/dspam.php", - $sample_msg); - - @file_put_contents("{$firstrun}", $sample_msg); - $savemsg .= " »{$firstrun}«, "; - } - - /* create firstspam.txt */ - if (! file_exists("{$firstspam}")) { - $sample_msg = file_get_contents("{$CONFIG['DSPAM_HOME']}/firstspam.txt.sample"); - - $sample_msg = str_replace("support", $support_user, $sample_msg); - $sample_msg = str_replace("configureme.com", $user_domain, $sample_msg); - $sample_msg = str_replace("http://www.yourdomain.com/dspam/", - "http://{$hostname}.{$domain}/dspam.php", - $sample_msg); - - @file_put_contents("{$firstspam}", $sample_msg); - $savemsg .= " »{$firstspam}«, "; - } - - /* create quarantinefull.txt */ - if (! file_exists("{$quarantinefull}")) { - $sample_msg = file_get_contents("{$CONFIG['DSPAM_HOME']}/quarantinefull.txt.sample"); - - $sample_msg = str_replace("support", $support_user, $sample_msg); - $sample_msg = str_replace("configureme.com", $user_domain, $sample_msg); - $sample_msg = str_replace("http://www.yourdomain.com/dspam/", - "http://{$hostname}.{$domain}/dspam.php", - $sample_msg); - - @file_put_contents("{$quarantinefull}", $sample_msg); - $savemsg .= " »{$quarantinefull}«."; - } - - if ($savemsg <> "") { - $savemsg = gettext("The following files were created: ") . $savemsg; - return $savemsg; - } - - return; -} - -function createNotificationMessages() { - global $config, $CONFIG, $USER, $CURRENT_USER; - - $firstrun = "{$CONFIG['DSPAM_HOME']}/firstrun.txt"; - $firstspam = "{$CONFIG['DSPAM_HOME']}/firstspam.txt"; - $quarantinefull = "{$CONFIG['DSPAM_HOME']}/quarantinefull.txt"; - $savemsg = ""; - - if (isset($config['installedpackages']['dspam']['config'][0]['dspam-domain'])) - $domain = $config['installedpackages']['dspam']['config'][0]['dspam-domain']; - else - $domain = $config['system']['domain']; - - $hostname = $config['system']['hostname']; - $support_user = $config['installedpackages']['dspam']['config'][0]['dspam-contact']; - - /* return if there are no sample files */ - if (! file_exists("{$CONFIG['DSPAM_HOME']}/firstrun.txt.sample") || - ! file_exists("{$CONFIG['DSPAM_HOME']}/firstspam.txt.sample") || - ! file_exists("{$CONFIG['DSPAM_HOME']}/quarantinefull.txt.sample")) { - return; - } - - /* create firstrun.txt */ - if (! file_exists("{$CONFIG['DSPAM_HOME']}/firstrun.txt")) { - $sample_msg = file_get_contents("{$CONFIG['DSPAM_HOME']}/firstrun.txt.sample"); - - $sample_msg = str_replace("support", $support_user, $sample_msg); - $sample_msg = str_replace("configureme.com", $domain, $sample_msg); - $sample_msg = str_replace("http://www.yourdomain.com/dspam/", - "http://{$hostname}.{$domain}/dspam.php", - $sample_msg); - - @file_put_contents("{$firstrun}", $sample_msg); - $savemsg .= " »{$firstrun}«, "; - } - - /* create firstspam.txt */ - if (! file_exists("{$CONFIG['DSPAM_HOME']}/firstspam.txt")) { - $sample_msg = file_get_contents("{$CONFIG['DSPAM_HOME']}/firstspam.txt.sample"); - - $sample_msg = str_replace("support", $support_user, $sample_msg); - $sample_msg = str_replace("configureme.com", $domain, $sample_msg); - $sample_msg = str_replace("http://www.yourdomain.com/dspam/", - "http://{$hostname}.{$domain}/dspam.php", - $sample_msg); - - @file_put_contents("{$firstspam}", $sample_msg); - $savemsg .= " »{$firstspam}«, "; - } - - /* create quarantinefull.txt */ - if (! file_exists("{$CONFIG['DSPAM_HOME']}/quarantinefull.txt")) { - $sample_msg = file_get_contents("{$CONFIG['DSPAM_HOME']}/quarantinefull.txt.sample"); - - $sample_msg = str_replace("support", $support_user, $sample_msg); - $sample_msg = str_replace("configureme.com", $domain, $sample_msg); - $sample_msg = str_replace("http://www.yourdomain.com/dspam/", - "http://{$hostname}.{$domain}/dspam.php", - $sample_msg); - - @file_put_contents("{$quarantinefull}", $sample_msg); - $savemsg .= " »{$quarantinefull}«."; - } - - if ($savemsg <> "") { - $savemsg = gettext("The following files were created: ") . $savemsg; - return $savemsg; - } - - return; -} - -function &check_dspam_installation() { - global $config; - - /* create RC files if necessary */ - if (! file_exists("/usr/local/etc/rc.d")) { - @mkdir("/usr/local/etc/rc.d"); - } - if (! file_exists("/usr/local/etc/rc.d/000.mysql.sh")) { - @copy("/usr/local/pkg/000.mysql.sh", "/usr/local/etc/rc.d/000.mysql.sh"); - @chmod("/usr/local/etc/rc.d/000.mysql.sh", 0755); - } - if (! file_exists("/usr/local/etc/rc.d/010.clamav-clamd.sh")) { - @copy("/usr/local/pkg/010.clamav-clamd.sh", - "/usr/local/etc/rc.d/010.clamav-clamd.sh"); - @chmod("/usr/local/etc/rc.d/010.clamav-clamd.sh", 0755); - } - if (! file_exists("/usr/local/etc/rc.d/020.clamav-freshclam.sh")) { - @copy("/usr/local/pkg/020.clamav-freshclam.sh", - "/usr/local/etc/rc.d/020.clamav-freshclam.sh"); - @chmod("/usr/local/etc/rc.d/020.clamav-freshclam.sh", 0755); - } - if (! file_exists("/usr/local/etc/rc.d/030.p3scan.sh")) { - @copy("/usr/local/pkg/030.p3scan.sh", - "/usr/local/etc/rc.d/030.p3scan.sh"); - @chmod("/usr/local/etc/rc.d/030.p3scan.sh", 0755); - } - - /* create conf files for those packages DSPAM depends on */ - if (! file_exists("/usr/local/etc/clamd.conf")) { - @copy("/usr/local/pkg/clamd.conf", - "/usr/local/etc/clamd.conf"); - } - if (! file_exists("/usr/local/etc/freshclam.conf")) { - @copy("/usr/local/pkg/freshclam.conf", - "/usr/local/etc/freshclam.conf"); - } - - if (! is_service_running("dspam")) { - $input_errors[] = "The DSPAM daemon process is not running. " . - "If you are certain that you did configure DSPAM " . - "appropriatly, you can start the corresponding process " . - "using the service control panel which is part of the " . - "»Status« menu item."; - } - if (! is_service_running("p3scan")) { - $input_errors[] = "The POP3 proxy process is not running. " . - "If you are certain that you did configure the POP3 proxy " . - "appropriatly, you can start the corresponding process " . - "using the service control panel which is part of the " . - "»Status« menu item."; - } - if (! is_service_running("clamd")) { - $input_errors[] = "The ClamAV daemon process is not running. " . - "If you are certain that you did configure DSPAM " . - "appropriatly, you can start the corresponding process " . - "using the service control panel which is part of the " . - "»Status« menu item (ClamAV does not need any configuration)."; - } - if (! is_service_running("freshclam")) { - $input_errors[] = "The freshclam daemon process is not running. " . - "If you are certain that you did configure DSPAM " . - "appropriatly, you can start the corresponding process " . - "using the service control panel which is part of the " . - "»Status« menu item (freshclam does not need any configuration)."; - } - if (! is_service_running("mysql")) { - $input_errors[] = "The MySQL daemon process is not running. " . - "If you are certain that you did configure DSPAM " . - "appropriatly, you can start the corresponding process " . - "using the service control panel which is part of the " . - "»Status« menu item (MySQL does not need any configuration)."; - } - - if (empty($config['installedpackages']['dspam']['config']) || - empty($config['installedpackages']['dspam']['config'][0]['storage-driver']) || - (file_exists('/usr/local/etc/dspam.conf') == false)) { - /* create default config files etc. */ - sync_package_dspam(); - - $input_errors[] = "It seems that you are using DSPAM for the very first time. " . - "Please run the DSPAM wizard from the »Services« menu " . - "if you would like to configure DSPAM right now. " . - "If you are not eligible to administer DSPAM you may contact " . - "your local DSPAM admin personal to solve this issue."; - } - - return $input_errors; -} - -?> diff --git a/packages/dspam/pkg/dspam.inc b/packages/dspam/pkg/dspam.inc deleted file mode 100644 index 9a821e6a..00000000 --- a/packages/dspam/pkg/dspam.inc +++ /dev/null @@ -1,360 +0,0 @@ - - - Unauthorized Access - - - -

Unauthorized Access - You will be redirected shortly!

- - -EOD; - print $htmlstr; - exit; - } -} - -/* - * only DSPAM admins can change the current user without logging out - * and logging in as another user again. - */ -if ($_POST) { - if (! empty($_POST['username']) && $CONFIG['ADMIN'] == 1) { - $CURRENT_USER = $_POST['username']; - } -} -if ($_GET) { - if (! empty($_GET['user']) && $CONFIG['ADMIN'] == 1) { - $CURRENT_USER = $_GET['user']; - } -} - -if ($CURRENT_USER == "") { - $input_errors[] = "System Error. I was unable to determine your identity."; -} - -preg_replace('/%CURRENT_USER%/', $CURRENT_USER, $CONFIG['DSPAM_ARGS']); - -/* current store */ -$PREF =& GetPrefs($CURRENT_USER); -$CURRENT_STORE = $PREF['localStore']; -if ($CURRENT_STORE == "") {$CURRENT_STORE = $CURRENT_USER; } - -$USER = GetPath($CURRENT_STORE); -$MAILBOX = $USER . ".mbox"; -$TMPFILE = $USER . ".tmp"; - -/* - * Set up initial display variables - */ -CheckQuarantine(); -$DATA['REMOTE_USER'] = $CURRENT_USER; - -/* - * Check whether DSPAM is already configured. - */ -$install_errors =& check_dspam_installation(); -$input_errors = array_merge($input_errors, $install_errors); - -/* - * Check whether we should generate notification messages - */ -if (isset($config['installedpackages']['dspam']['config'][0]['notification-email'])) { - $tmpmsg = createNotificationMessages(); - if (! empty($tmpmsg)) - $tmpmsg .= "\n" . createUserNotificationMessages(); - else - $tmpmsg = createUserNotificationMessages(); - - $savemsg =& $tmpmsg; -} - -/* - * Process Commands - */ -if (isset($pgtitle) && is_array($pgtitle)) { - /* Performance */ - if (basename($_SERVER['SCRIPT_NAME']) == "dspam-perf.php") { - if ($_GET) { - if ($GET['command'] == "resetStats") { - ResetStats(); - } else if ($GET['command'] == "tweak") { - Tweak(); - } - } - - $display_errors =& DisplayIndex(); - $input_errors = array_merge($input_errors, $display_errors); - } - - /* Preferences */ - else if (basename($_SERVER['SCRIPT_NAME']) == "dspam-prefs.php") { - $savemsg = ""; - $prefs_errors =& DisplayPreferences(NULL, $savemsg); - $input_errors = array_merge($input_errors, $prefs_errors); - } - - /* Quarantine */ - else if (basename($_SERVER['SCRIPT_NAME']) == "dspam-quarantine.php") { - if ($_GET) { - if ($_GET['command'] == "viewMessage") { - $showpart = 0; - $ctype = 0; - $sortby = "Rating"; - $currentPage = 1; - $qPerPage = 0; - - if (isset($_GET['showpart'])) { $showpart = $_GET['showpart']; } - if (isset($_GET['ctype'])) { $ctype = intval($_GET['ctype']); } - if (isset($_GET['sortby'])) { $sortby = $_GET['sortby']; } - if (isset($_GET['page'])) { $currentPage = $_GET['page']; } - if (isset($_GET['qperpage'])) { $qPerPage = $_GET['qperpage']; } - - $quarantine_errors =& QuarantineViewMessage($_GET['signatureID'], - $showpart, - $ctype, - $sortby, - $currentPage, - $qPerPage); - $input_errors = array_merge($input_errors, $quarantine_errors); - } else if (isset($_GET['sortby'])) { - $qperpage = $CONFIG['QUARANTINE_PER_PAGE']; - if (isset($_GET['qperpage'])) { $qperpage = $_GET['qperpage']; } - $page = 1; - if (isset($_GET['page'])) { $page = $_GET['page']; } - - $quarantine_errors =& DisplayQuarantine($_GET['sortby'], - intval($page), - intval($qperpage)); - $input_errors = array_merge($input_errors, $quarantine_errors); - } else if (isset($_GET['qperpage'])) { - if (isset($_GET['page'])) { - $quarantine_errors =& DisplayQuarantine($CONFIG['SORT_DEFAULT'], - intval($_GET['page']), - intval($_GET['qperpage'])); - $input_errors = array_merge($input_errors, $quarantine_errors); - } else { - $quarantine_errors =& DisplayQuarantine($CONFIG['SORT_DEFAULT'], - 1, - intval($_GET['qperpage'])); - $input_errors = array_merge($input_errors, $quarantine_errors); - } - } else { - $displayq_errors =& DisplayQuarantine($CONFIG['SORT_DEFAULT'], 1); - $input_errors = array_merge($input_errors, $displayq_errors); - } - } else if ($_POST) { - if ($_POST['command'] == "processQuarantine") { - $signatures = array(); - - while (list($key, $val) = each($_POST)) { - if (strpos($key, "chkmsg") !== false) { - $signatures[$key] = $val; - } - } - if ($_POST['processAction']) { - $processq_errors =& ProcessQuarantine($signatures, - $_POST['processAction'], - $_POST['sortby'], - intval($_POST['qpage']), - intval($_POST['qperpage'])); - $input_errors = array_merge($input_errors, $processq_errors); - } else { - $processq_errors =& ProcessQuarantine($signatures, - "None", - $_POST['sortby'], - intval($_POST['qpage']), - intval($_POST['qperpage'])); - $input_errors = array_merge($input_errors, $processq_errors); - } - } else if ($_POST['command'] == "processFalsePositive") { - $processfp_errors =& ProcessFalsePositive($_POST['signatureID'], - $_POST['sortby'], - intval($_POST['qpage']), - intval($_POST['qperpage'])); - $input_errors = array_merge($input_errors, $processfp_errors); - $displayq_errors =& DisplayQuarantine($_POST['sortby'], - intval($_POST['qpage']), - intval($_POST['qperpage'])); - $input_errors = array_merge($input_errors, $displayq_errors); - } - } else { - /* usually this particular line of code should not be hit because - * the user always triggers a GET or POST action. Unfortunatly at - * the time, the alerts page is implemented in a way that neither - * triggers a GET nor a POST action if initially accessed via the - * tab. Hence this final catch all else. - */ - $displayq_errors =& DisplayQuarantine($CONFIG['SORT_DEFAULT'], 1); - $input_errors = array_merge($input_errors, $displayq_errors); - } - } - - /* Analysis */ - else if (basename($_SERVER['SCRIPT_NAME']) == "dspam-analysis.php") { - $displaya_errors =& DisplayAnalysis(); - $input_errors = array_merge($input_errors, $displaya_errors); - } - - /* History */ - else if (in_array(gettext("History"), $pgtitle)) { - if ($_POST) { - /* Form fields that may be submited via POST: - * - command - * - username - * - msgid$retrain_checked_msg_no (checkbox, multible times) - */ - $checked = array(); - - while (list($key, $val) = each($_POST)) { - if (strpos($key, "msgid") !== false) { - $checked[] = $val; - } - } - - $displayh_errors =& DisplayHistory($_POST['command'], - "", - $checked, - $_POST['username'], - "", - $_POST['hpage'], - $_POST['hperpage']); - $input_errors = array_merge($input_errors, $displayh_errors); - } else if ($_GET) { - /* Form fields that may be submited via GET: - * - history_page - * - command - * - signatureID - * - retrain - * - user - */ - $displayh_errors =& DisplayHistory($_GET['command'], - $_GET['signatureID'], - NULL, - $_GET['user'], - $_GET['retrain'], - isset($_GET['page']) ? intval($_GET['page']) : 1, - isset($_GET['hperpage']) ? $_GET['hperpage'] : $CONFIG['QUARANTINE_PER_PAGE']); - $input_errors = array_merge($input_errors, $displayh_errors); - } else { - $displayh_errors =& DisplayHistory("", // command - "", // signature ID - NULL, // signatures to be retrained - $CURRENT_USER); - $input_errors = array_merge($input_errors, $displayh_errors); - } - } else if (in_array(gettext("Fragment"), $pgtitle)) { - if ($_GET) { - $displayf_errors =& DisplayFragment($_GET['signatureID'], - $_GET['from'], - $_GET['subject'], - $_GET['info'], - $_GET['time']); - $input_errors = array_merge($input_errors, $displayf_errors); - } - } - - /* Info Page */ - else if (basename($_SERVER['SCRIPT_NAME']) == "dspam.php") { - $info_errors =& DisplayInfos(); - $input_errors = array_merge($input_errors, $info_errors); - } - -/* ========================================================================== */ -/* = A D M I N R E L A T E D F U N C T I O N C A L L S = */ -/* ========================================================================== */ - - /* Status */ - else if (basename($_SERVER['SCRIPT_NAME']) == "dspam-admin.php" && $CONFIG['ADMIN']) { - $displays_errors =& DisplayStatus(); - $input_errors = array_merge($input_errors, $displays_errors); - } - - /* User Statistics */ - else if (basename($_SERVER['SCRIPT_NAME']) == "dspam-admin-stats.php" && $CONFIG['ADMIN']) { - $displayus_errors =& DisplayUserStatistics(); - $input_errors = array_merge($input_errors, $displayus_errors); - } - - /* Preferences */ - else if (basename($_SERVER['SCRIPT_NAME']) == "dspam-admin-prefs.php" && $CONFIG['ADMIN']) { - $savemsg = ""; - $displayap_errors =& DisplayAdminPreferences($savemsg); - $input_errors = array_merge($input_errors, $displayap_errors); - } -} else { - $input_errors[] = "The page you did request can't be processed by dspam.inc."; -} - -?> \ No newline at end of file diff --git a/packages/dspam/pkg/dspam.xml b/packages/dspam/pkg/dspam.xml deleted file mode 100644 index 59740ae1..00000000 --- a/packages/dspam/pkg/dspam.xml +++ /dev/null @@ -1,342 +0,0 @@ - - - - - - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper . - 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. - */ -/* ========================================================================== */ - ]]> - Describe your package here - Describe your package requirements here - Currently there are no FAQ items provided. - dspam - 1.0 - Services: DSPAM: Main - /usr/local/pkg/dspam.inc - - - dspam -
Services
- dspam.xml - /dspam-perf.php -
- - DSPAM Legacy WebGUI - Original Perl-based GUI -
Services
- /vhosts/dspam/dspam.cgi -
- - dspam - /usr/local/etc/rc.d/dspam.sh - - - - Overview - /dspam.php - - - - Performance - /dspam-perf.php - - - Preferences - /dspam-prefs.php - - - Alerts - /pkg.php?xml=dspam_alerts.xml - - - Quarantine - /dspam-quarantine.php - - - Analysis - /dspam-analysis.php - - - History - /dspam-history.php - - - - ['installedpackages']['dspam']['config'] - - - /usr/local/www/ - 0755 - http://www.pfsense.com/packages/config/dspam/www/dspam.php - - - /usr/local/www/ - 0755 - http://www.pfsense.com/packages/config/dspam/www/dspam-perf.php - - - /usr/local/www/ - 0755 - http://www.pfsense.com/packages/config/dspam/www/dspam-admin.php - - - /usr/local/www/ - 0755 - http://www.pfsense.com/packages/config/dspam/www/dspam-admin-graph.php - - - /usr/local/www/ - 0755 - http://www.pfsense.com/packages/config/dspam/www/dspam-admin-prefs.php - - - /usr/local/www/ - 0755 - http://www.pfsense.com/packages/config/dspam/www/dspam-admin-stats.php - - - /usr/local/pkg/ - 0755 - http://www.abyssworld.de/packages/config/dspam_settings.xml - - - /usr/local/www/ - 0755 - http://www.abyssworld.de/packages/config/dspam-settings.php - - - /usr/local/www/ - 0755 - http://www.abyssworld.de/packages/config/dspam-settings-algo.php - - - /usr/local/www/ - 0755 - http://www.abyssworld.de/packages/config/dspam-settings-bmta.php - - - /usr/local/www/ - 0755 - http://www.abyssworld.de/packages/config/dspam-settings-feat.php - - - /usr/local/www/ - 0755 - http://www.abyssworld.de/packages/config/dspam-header.php - - - /usr/local/www/ - 0755 - http://www.abyssworld.de/packages/config/dspam-overr.php - - - /usr/local/www/ - 0755 - http://www.abyssworld.de/packages/config/dspam-settings-prefs.php - - - /usr/local/www/ - 0755 - http://www.abyssworld.de/packages/config/dspam-spwd.php - - - /usr/local/www/ - 0755 - http://www.abyssworld.de/packages/config/dspam-tuser.php - - - /usr/local/www/ - 0755 - http://www.abyssworld.de/packages/config/dspam-train.php - - - /usr/local/www/ - 0755 - http://www.abyssworld.de/packages/config/dspam-viewmsg.php - - - /usr/local/www/ - 0755 - http://www.abyssworld.de/packages/config/verdana.ttf - - - /usr/local/www/ - 0755 - http://www.pfsense.com/packages/config/dspam/www/dspam-prefs.php - - - /usr/local/www/ - 0755 - http://www.pfsense.com/packages/config/dspam/www/dspam-quarantine.php - - - /usr/local/www/ - 0755 - http://www.pfsense.com/packages/config/dspam/www/dspam-analysis.php - - - /usr/local/www/ - 0755 - http://www.pfsense.com/packages/config/dspam/www/dspam-analysis-graph.php - - - /usr/local/www/ - 0755 - http://www.pfsense.com/packages/config/dspam/www/dspam-hfragment.php - - - /usr/local/www/ - 0755 - http://www.pfsense.com/packages/config/dspam/www/dspam-history.php - - - - /usr/local/pkg/ - 0755 - http://www.abyssworld.de/packages/config/dspam_alerts.xml - - - /usr/local/pkg/ - 0755 - http://www.pfsense.com/packages/config/dspam/pkg/dspam.inc - - - /usr/local/pkg/ - 0755 - http://www.pfsense.com/packages/config/dspam/pkg/dspam-config.inc - - - /usr/local/pkg/ - 0755 - http://www.pfsense.com/packages/config/dspam/pkg/dspam-guifunc.inc - - - /usr/local/pkg/ - 0755 - http://www.pfsense.com/packages/config/dspam/pkg/dspam-pkgfunc.inc - - - /usr/local/pkg/ - 0755 - http://www.pfsense.com/packages/config/dspam/pkg/dspam-utilfunc.inc - - - /usr/local/pkg/ - 0755 - http://www.pfsense.com/packages/config/dspam/pkg/000.mysql.sh - - - /usr/local/pkg/ - 0755 - http://www.pfsense.com/packages/config/dspam/pkg/010.clamav-clamd.sh - - - /usr/local/pkg/ - 0755 - http://www.pfsense.com/packages/config/dspam/pkg/020.clamav-freshclam.sh - - - /usr/local/pkg/ - 0755 - http://www.pfsense.com/packages/config/dspam/pkg/030.p3scan.sh - - - /usr/local/pkg/ - 0755 - http://www.pfsense.com/packages/config/dspam/pkg/clamd.conf - - - /usr/local/pkg/ - 0755 - http://www.pfsense.com/packages/config/dspam/pkg/default.prefs.sample - - - /usr/local/pkg/ - 0755 - http://www.pfsense.com/packages/config/dspam/pkg/freshclam.conf - - - - /usr/local/www/wizards/ - 0755 - http://www.pfsense.com/packages/config/dspam/www/wizards/dspam_wizard.xml - - - /usr/local/www/wizards/ - 0755 - http://www.pfsense.com/packages/config/dspam/www/wizards/dspam-lda-proxy.png - - - /usr/local/www/wizards/ - 0755 - http://www.pfsense.com/packages/config/dspam/www/wizards/dspam-pop-proxy.png - - - /usr/local/www/wizards/ - 0755 - http://www.pfsense.com/packages/config/dspam/www/wizards/dspam-smtp-relay.png - - - /usr/local/www/ - 0755 - http://www.pfsense.com/packages/config/dspam/pkg/verdana.ttf - - - /usr/local/www/themes/metallic/ - 0755 - http://www.pfsense.com/packages/config/dspam/www/themes/metallic/dspam.css - - - - - sync_package_dspam(); - - - custom_php_install_command(); - - - custom_php_deinstall_command(); - -
diff --git a/packages/dspam/pkg/dspam_alerts.xml b/packages/dspam/pkg/dspam_alerts.xml deleted file mode 100644 index ea59cfd2..00000000 --- a/packages/dspam/pkg/dspam_alerts.xml +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper . - 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. - */ -/* ========================================================================== */ - ]]> - - Describe your package here - Describe your package requirements here - Currently there are no FAQ items provided. - dspamalerts - 1.0 - Services: DSPAM: Alerts - /usr/local/pkg/dspam.inc - - - - Performance - /dspam-perf.php - - - Preferences - /dspam-prefs.php - - - Alerts - /pkg.php?xml=dspam_alerts.xml - - - - Quarantine - /dspam-quarantine.php - - - Analysis - /dspam-analysis.php - - - History - /dspam-history.php - - - Train Filter - /dspam-train.php - - - Admin Suite - /dspam-admin.php - - - - ['installedpackages']['dspam']['config']['alerts'] - - - Alert Name - alertname - - - Description - description - - - - - - Alert Name - alertname - Name of an alert that should be raised - input - 30 - - - - Description - description - You may enter a description here for your reference (not parsed). - input - 30 - - - - - dspam_configure(); - - - dspam_configure(); - - \ No newline at end of file diff --git a/packages/dspam/pkg/freshclam.conf b/packages/dspam/pkg/freshclam.conf deleted file mode 100644 index 173d97bf..00000000 --- a/packages/dspam/pkg/freshclam.conf +++ /dev/null @@ -1,110 +0,0 @@ -## -## Example config file for freshclam -## Please read the freshclam.conf(5) manual before editing this file. -## This file may be optionally merged with clamd.conf. -## - - -# Comment or remove the line below. -#Example - -# Path to the database directory. -# WARNING: It must match clamd.conf's directive! -# Default: hardcoded (depends on installation options) -#DatabaseDirectory /var/lib/clamav -DatabaseDirectory /var/db/clamav - -# Path to the log file (make sure it has proper permissions) -# Default: disabled -#UpdateLogFile /var/log/freshclam.log -UpdateLogFile /var/log/clamav/freshclam.log - -# Enable verbose logging. -# Default: no -#LogVerbose yes - -# Use system logger (can work together with UpdateLogFile). -# Default: no -#LogSyslog yes - -# Specify the type of syslog messages - please refer to 'man syslog' -# for facility names. -# Default: LOG_LOCAL6 -#LogFacility LOG_MAIL - -# This option allows you to save the process identifier of the daemyes -# Default: disabled -#PidFile /var/run/freshclam.pid -PidFile /var/run/clamav/freshclam.pid - -# By default when started freshclam drops privileges and switches to the -# "clamav" user. This directive allows you to change the database owner. -# Default: clamav (may depend on installation options) -DatabaseOwner clamav - -# Initialize supplementary group access (freshclam must be started by root). -# Default: no -AllowSupplementaryGroups yes - -# Use DNS to verify virus database version. Freshclam uses DNS TXT records -# to verify database and software versions. With this directive you can change -# the database verification domain. -# WARNING: Do not touch it unless you're configuring freshclam to use your -# own database verification domain. -# Default: current.cvd.clamav.net -#DNSDatabaseInfo current.cvd.clamav.net - -# Uncomment the following line and replace XY with your country -# code. See http://www.iana.org/cctld/cctld-whois.htm for the full list. -#DatabaseMirror db.XY.clamav.net - -# database.clamav.net is a round-robin record which points to our most -# reliable mirrors. It's used as a fall back in case db.XY.clamav.net is -# not working. DO NOT TOUCH the following line unless you know what you -# are doing. -DatabaseMirror database.clamav.net - -# How many attempts to make before giving up. -# Default: 3 (per mirror) -#MaxAttempts 5 - -# Number of database checks per day. -# Default: 12 (every two hours) -#Checks 24 - -# Proxy settings -# Default: disabled -#HTTPProxyServer myproxy.com -#HTTPProxyPort 1234 -#HTTPProxyUsername myusername -#HTTPProxyPassword mypass - -# Use aaa.bbb.ccc.ddd as client address for downloading databases. Useful for -# multi-homed systems. -# Default: Use OS'es default outgoing IP address. -#LocalIPAddress aaa.bbb.ccc.ddd - -# Send the RELOAD command to clamd. -# Default: no -NotifyClamd /usr/local/etc/clamd.conf - -# Run command after successful database update. -# Default: disabled -#OnUpdateExecute command - -# Run command when database update process fails. -# Default: disabled -#OnErrorExecute command - -# Run command when freshclam reports outdated version. -# In the command string %v will be replaced by the new version number. -# Default: disabled -#OnOutdatedExecute command - -# Don't fork into background. -# Default: no -#Foreground yes - -# Enable debug messages in libclamav. -# Default: no -#Debug yes diff --git a/packages/dspam/pkg/p3scan-pf-emer.xml b/packages/dspam/pkg/p3scan-pf-emer.xml deleted file mode 100644 index 7475e23c..00000000 --- a/packages/dspam/pkg/p3scan-pf-emer.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper . - 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. - */ -/* ========================================================================== */ - ]]> - - Describe your package here - Describe your package requirements here - Currently there are no FAQ items provided. - - p3scanpfemer - 1.0 - Services: POP3 Proxy: Emergency Contact - /usr/local/pkg/p3scan.inc - - - Daemon Settings - /pkg_edit.php?xml=p3scan-pf.xml&id=0 - - - Message Processing - /pkg_edit.php?xml=p3scan-pf-msg.xml&id=0 - - - Emergency Contact - /pkg.php?xml=p3scan-pf-emer.xml - - - - Virus Scanner Settings - /pkg_edit.php?xml=p3scan-pf-vir.xml&id=0 - - - SPAM Settings - /pkg_edit.php?xml=p3scan-pf-spam.xml&id=0 - - - - ['installedpackages']['p3scanpf']['config']['contacts'] - - - - Email Address - emailaddress - - - Description - description - - - - - - Email Address - emailaddress - - In the event p3scan encounters a catastrophic problem and has to terminate, - it will send an email to these email addresses just before setting up to - close down on the next iteration of a child process. - - input - - - Description - description - Description. - input - - - - - sync_package_p3scan(); - - - sync_package_p3scan(); - - diff --git a/packages/dspam/pkg/p3scan-pf-msg.xml b/packages/dspam/pkg/p3scan-pf-msg.xml deleted file mode 100644 index b2144fe6..00000000 --- a/packages/dspam/pkg/p3scan-pf-msg.xml +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper . - 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. - */ -/* ========================================================================== */ - ]]> - - Describe your package here - Describe your package requirements here - Currently there are no FAQ items provided. - - p3scanpfmsg - 1.0 - Services: POP3 Proxy: Message Processing - - This <acronym title="Hypertext Markup Language">HTML</acronym> page uses default values, hence even if each field is - set, you are still required to save this page if you are editing this page - for the very first time! - - pkg_edit.php?xml=p3scan-pf-msg.xml&id=0 - /usr/local/pkg/p3scan.inc - - - Daemon Settings - /pkg_edit.php?xml=p3scan-pf.xml&id=0 - - - Message Processing - /pkg_edit.php?xml=p3scan-pf-msg.xml&id=0 - - - - Emergency Contact - /pkg.php?xml=p3scan-pf-emer.xml - - - Virus Scanner Settings - /pkg_edit.php?xml=p3scan-pf-vir.xml&id=0 - - - SPAM Settings - /pkg_edit.php?xml=p3scan-pf-spam.xml&id=0 - - - - ['installedpackages']['p3scanpf']['config']['messaging'] - - - - Just Delete - justdelete - - Instead of keeping an infected message in the Virus Directory, delete it - after reporting it to the user. - - checkbox - true - - - Bytes Free - bytesfree - The number of KB's there must be free before processing any mail. - input - - 10000 - - - Broken Email Clients - brokenec - - Some email clients may require special processing. - - checkbox - true - - - ISP Spam - ispspam - - This option allows you to set the string your <acronym title="Internet Service Provider">ISP</acronym> uses if it processes - your email for SPAM. Leave this field blank if you are not going to use - this option. - - input - -- Spam -- - - - Subject - subject - - This option can be used to change the default subject line when - reporting a virus infected message. - - input - 60 - - Subject: "[Virus] found in a mail to you:" <virus name> - - - Notify - notify - - This option can be used to change the default file deleted notification - that is displayed in the virus notification message when the - "justdelete" option is used. - - input - 60 - - Per instruction, the message has been deleted. - - - SMTP Reject - smtpreject - - This option can be used to change the default lt;acronym title="Simple Mail Transfer Protocol">SMTP</acronym> Reject message that - is sent to the client in the event a message is rejected due to a virus. - The error message will have a prefix of "554". - - input - 60 - - Virus detected! P3scan rejected message! - - - Check SMTP size - checksize - - This option can be used to set the maximum message size (in KBytes) - that p3scan will use to determine if it should scan an smtp submission. - Leave this field blank if you are not going to use this option. - - input - 1024 - - - Footer - footer - - This option is used to add the virus definition info from your scanner - to an SMTP message. Leave this field blank if you are not going to use - this option. - - input - 40 - /usr/local/bin/clamdscan -V - - - - - sync_package_p3scan(); - - diff --git a/packages/dspam/pkg/p3scan-pf-spam.xml b/packages/dspam/pkg/p3scan-pf-spam.xml deleted file mode 100644 index eae78a0f..00000000 --- a/packages/dspam/pkg/p3scan-pf-spam.xml +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper . - 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. - */ -/* ========================================================================== */ - ]]> - - Describe your package here - Describe your package requirements here - Currently there are no FAQ items provided. - - p3scanpfspam - 1.0 - Services: POP3 Proxy: SPAM Settings - - This <acronym title="Hypertext Markup Language">HTML</acronym> page uses default values, hence even if each field is - set, you are still required to save this page if you are editing this page - for the very first time! - - pkg_edit.php?xml=p3scan-pf-spam.xml&id=0 - /usr/local/pkg/p3scan.inc - - - Daemon Settings - /pkg_edit.php?xml=p3scan-pf.xml&id=0 - - - Message Processing - pkg_edit.php?xml=p3scan-pf-msg.xml&id=0 - - - Emergency Contact - /pkg.php?xml=p3scan-pf-emer.xml - - - Virus Scanner Settings - /pkg_edit.php?xml=p3scan-pf-vir.xml&id=0 - - - SPAM Settings - /pkg_edit.php?xml=p3scan-pf-spam.xml&id=0 - - - - - ['installedpackages']['p3scanpf']['config']['spam'] - - - - Enable Spam Checking - checkspam - - If set, will scan for Spam before scanning for a virus. - - checkbox - true - spamcheck - - - SPAM Executable Command - spamcheck - The command (plus arguments) that should be invoked to check for SPAM messages. - input - 70 - - /usr/local/bin/dspam --user dspamuser --mode=teft --stdout --deliver=innocent,spam --feature=ch,no,wh - - - - - - sync_package_p3scan(); - - diff --git a/packages/dspam/pkg/p3scan-pf-vir.xml b/packages/dspam/pkg/p3scan-pf-vir.xml deleted file mode 100644 index ed68b8cf..00000000 --- a/packages/dspam/pkg/p3scan-pf-vir.xml +++ /dev/null @@ -1,162 +0,0 @@ - - - - - - - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper . - 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. - */ -/* ========================================================================== */ - ]]> - - Describe your package here - Describe your package requirements here - Currently there are no FAQ items provided. - - p3scanpfvir - 1.0 - Services: POP3 Proxy: Virus Scanner Settings - - This <acronym title="Hypertext Markup Language">HTML</acronym> page uses default values, hence even if each field is - set, you are still required to save this page if you are editing this page - for the very first time! - - pkg_edit.php?xml=p3scan-pf-vir.xml&id=0 - /usr/local/pkg/p3scan.inc - - - Daemon Settings - /pkg_edit.php?xml=p3scan-pf.xml&id=0 - - - Message Processing - /pkg_edit.php?xml=p3scan-pf-msg.xml&id=0 - - - Emergency Contact - /pkg.php?xml=p3scan-pf-emer.xml - - - Virus Scanner Settings - /pkg_edit.php?xml=p3scan-pf-vir.xml&id=0 - - - - SPAM Settings - /pkg_edit.php?xml=p3scan-pf-spam.xml&id=0 - - - - ['installedpackages']['p3scanpf']['config']['virus'] - - - - Scanner Type - scannertype - Select here which type of scanner you want to use. - select - 1 - clamd - - - - - - - - - - - Virusscanner - scanner - Depends on scannertype. - input - - 127.0.0.1:3310 - - - Scanner Returncode - viruscode - - Specify the returncode(s) which the scanner returns when - the mail is infected. - - input - 1 - - - Good Scanner return codes - goodcode - - Some scanners can report more than good or infected. Place valid return - codes here that will enable the message to be delivered without a warning. - - input - - - Regular Expression for Virusname - virusregexp - - Specify here a regular expression which describes where the name of - the virus can be found. - - input - .*: (.*) FOUND - - - deMIME Setting - demime - - Tick this if we should parse all lt;acronym title="Multipurpose Internet Mail Extensions">MIME</acronym>-sections instead of passing the - message as-is to the scanner. - - checkbox - true - - - - - sync_package_p3scan(); - - diff --git a/packages/dspam/pkg/p3scan-pf.xml b/packages/dspam/pkg/p3scan-pf.xml deleted file mode 100644 index f78c3912..00000000 --- a/packages/dspam/pkg/p3scan-pf.xml +++ /dev/null @@ -1,211 +0,0 @@ - - - - - - - All rights reserved. - - Based on m0n0wall (http://m0n0.ch/wall) - Copyright (C) 2003-2006 Manuel Kasper . - 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. - */ -/* ========================================================================== */ - ]]> - - Describe your package here - Describe your package requirements here - Currently there are no FAQ items provided. - p3scanpf - 1.0 - Services: POP3 Proxy: Main - - This <acronym title="Hypertext Markup Language">HTML</acronym> page uses default values, hence even if each field is - set, you are still required to save this page if you are editing this page - for the very first time! - - pkg_edit.php?xml=p3scan-pf.xml&id=0 - /usr/local/pkg/p3scan.inc - - - p3scan - A transparent POP3-Proxy with virus-scanning capabilities -
Services
- p3scan.xml -
- - p3scan-pf - /usr/local/etc/rc.d/030.p3scan.sh - - - - Daemon Settings - /pkg_edit.php?xml=p3scan-pf.xml&id=0 - - - - Message Processing - /pkg_edit.php?xml=p3scan-pf-msg.xml&id=0 - - - Emergency Contact - /pkg.php?xml=p3scan-pf-emer.xml - - - Virus Scanner Settings - /pkg_edit.php?xml=p3scan-pf-vir.xml&id=0 - - - SPAM Settings - /pkg_edit.php?xml=p3scan-pf-spam.xml&id=0 - - - - ['installedpackages']['p3scanpf']['config'] - - /usr/local/pkg/ - 0755 - http://www.pfsense.com/packages/config/p3scan-pf-msg.xml - - - /usr/local/pkg/ - 0755 - http://www.pfsense.com/packages/config/p3scan-pf-emer.xml - - - /usr/local/pkg/ - 0755 - http://www.pfsense.com/packages/config/p3scan-pf-vir.xml - - - /usr/local/pkg/ - 0755 - http://www.pfsense.com/packages/config/p3scan-pf-spam.xml - - - /usr/local/www/ - 0755 - http://www.pfsense.com/packages/config/p3scan_rules.php - - - /usr/local/pkg/ - 0755 - http://www.pfsense.com/packages/config/p3scan.inc - - - - - Max Child's - maxchilds - The maximum number of connections we will handle at once. - input - 10 - - - IP Address - ipaddr - The <acronym title="Internet Protocol">IP</acronym> Address we listen on. - input - - 0.0.0.0 - - - Port - port - The <acronym title="Transmission Control Protocol">TCP</acronym> port on we should listen. - input - - 8110 - - - SSL Port - sslport - The TCP <acronym title="Secure Sockets Layer">SSL</acronym> port on we should listen. - input - - 995 - - - Target IP - targetip - Target IP is the IP to connect (0.0.0.0 enables transparent mode). - input - - 0.0.0.0 - - - Target Port - targetport - Target Port is the port to connect. - input - - 8110 - - - Email Port - emailport - The port we should listen on to scan outgoing email messages. - input - - 25 - - - Daemon User - daemonuser - The username the daemon should run as. - input - - root - - - - - sync_package_p3scan(); - - - sync_package_p3scan(); - - - custom_php_install_command(); - - - custom_php_deinstall_command(); - -
diff --git a/packages/dspam/pkg/p3scan.inc b/packages/dspam/pkg/p3scan.inc deleted file mode 100644 index 7d675050..00000000 --- a/packages/dspam/pkg/p3scan.inc +++ /dev/null @@ -1,277 +0,0 @@ - "") - fwrite($fd, "maxchilds = {$cfg['maxchilds']}\n"); - else - fwrite($fd, "maxchilds = 10\n"); - if (isset($cfg['ipaddr']) && $cfg['ipaddr'] <> "") - fwrite($fd, "ip = {$cfg['ipaddr']}\n"); - else - fwrite($fd, "ip = 0.0.0.0\n"); - /* TODO: Even if the port is configurable, it is - hardcoded in p3scan.c. This needs to be - changed for the sake of flexebility. - */ - if (isset($cfg['port']) && $cfg['port'] <> "") - fwrite($fd, "port = {$cfg['port']}\n"); - else - fwrite($fd, "port = 8110\n"); - if (isset($cfg['sslport']) && $cfg['sslport'] <> "") - fwrite($fd, "sslport = {$cfg['sslport']}\n"); - else - fwrite($fd, "sslport = 995\n"); - if (isset($cfg['targetip']) && $cfg['targetip'] <> "") - fwrite($fd, "targetip = {$cfg['targetip']}\n"); - else - fwrite($fd, "targetip = 0.0.0.0\n"); - if (isset($cfg['targetport']) && $cfg['targetport'] <> "") - fwrite($fd, "targetport = {$cfg['targetport']}\n"); - else - fwrite($fd, "targetport = 8110\n"); - if (isset($cfg['emailport']) && $cfg['emailport'] <> "") - fwrite($fd, "emailport = {$cfg['emailport']}\n"); - else - fwrite($fd, "emailport = 25\n"); - if (isset($cfg['daemonuser']) && $cfg['daemonuser'] <> "") - fwrite($fd, "user = {$cfg['daemonuser']}\n"); - else - fwrite($fd, "user = root\n"); - fwrite($fd, "notifydir = /var/spool/p3scan/notify\n"); - fwrite($fd, "virusdir = /var/spool/p3scan\n"); - fwrite($fd, "template = /usr/local/etc/p3scan/p3scan.mail\n"); - - /* ================================================================ */ - /* == Tab: Message Processing == */ - /* ================================================================ */ - fwrite($fd, "## Message Processing Settings.\n"); - if (isset($cfgmsg['justdelete']) && $cfgmsg['justdelete'] <> "") - fwrite($fd, "justdelete\n"); - if (isset($cfgmsg['bytesfree']) && $cfgmsg['bytesfree'] <> "") - fwrite($fd, "bytesfree = {$cfgmsg['bytesfree']}\n"); - else - fwrite($fd, "bytesfree = 10000\n"); - if (isset($cfgmsg['broken']) && $cfgmsg['broken'] <> "") - fwrite($fd, "broken\n"); - if (isset($cfgmsg['timeout']) && $cfgmsg['timeout'] <> "") - fwrite($fd, "timeout = {$cfgmsg['timeout']}\n"); - else - fwrite($fd, "timeout = 30\n"); - if (isset($cfgmsg['ispspam']) && $cfgmsg['ispspam'] <> "") - fwrite($fd, "ispspam = {$cfg['ispspam']}\n"); - if (file_exists("/usr/local/bin/renattach")) - fwrite($fd, "renattach = /usr/local/bin/renattach\n"); - if (isset($cfgmsg['subject']) && $cfgmsg['subject'] <> "") - fwrite($fd, "subject = {$cfgmsg['subject']}\n"); - else - fwrite($fd, "subject = Subject: \"[Virus] found in a mail to you:\" \n"); - if (isset($cfgmsg['notify']) && $cfgmsg['notify'] <> "") - fwrite($fd, "notify = {$cfgmsg['notify']}\n"); - else - fwrite($fd, "notify = Per instruction, the message has been deleted.\n"); - if (isset($cfgmsg['smtpreject']) && $cfgmsg['smtpreject'] <> "") - fwrite($fd, "smtprset = {$cfgmsg['smtpreject']}\n"); - else - fwrite($fd, "smtprset = Virus detected! P3scan rejected message!\n"); - if (isset($cfgmsg['checksize']) && $cfgmsg['checksize'] <> "") - fwrite($fd, "checksize = {$cfgmsg['checksize']}\n"); - if (isset($cfgmsg['footer']) && $cfgmsg['footer'] <> "") - fwrite($fd, "footer = {$cfgmsg['footer']}\n"); - - /* ================================================================ */ - /* == Tab: Emergency Contact == */ - /* ================================================================ */ - fwrite($fd, "## Emergency Contacts.\n"); - if (is_array($cfgemer)) { - foreach ($cfgemer as $addr) { - $contact .= "{$addr['emailaddress']} "; - } - if (isset($contact) && $contact <> "") - fwrite($fd, "emergcon = {$contact}\n"); - } - - /* ================================================================ */ - /* == Tab: Virus Scanner Settings == */ - /* ================================================================ */ - fwrite($fd, "## Virus Scanner Settings.\n"); - if (isset($cfgvir['scannertype']) && $cfgvir['scannertype'] <> "") - fwrite($fd, "scannertype = {$cfgvir['scannertype']}\n"); - else - fwrite($fd, "scannertype = clamd\n"); - if (isset($cfgvir['scanner']) && $cfgvir['scanner'] <> "") - fwrite($fd, "scanner = {$cfgvir['scanner']}\n"); - else - fwrite($fd, "scanner = 127.0.0.1:3310\n"); - if (isset($cfgvir['viruscode']) && $cfgvir['viruscode'] <> "") - fwrite($fd, "viruscode = {$cfgvir['viruscode']}\n"); - else - fwrite($fd, "viruscode = 1\n"); - if (isset($cfgvir['goodcode']) && $cfgvir['goodcode'] <> "") - fwrite($fd, "goodcode = {$cfgvir['goodcode']}\n"); - if (isset($cfgvir['virusregexp']) && $cfgvir['virusregexp'] <> "") - fwrite($fd, "virusregexp = {$cfgvir['virusregexp']}\n"); - if (isset($cfgvir['demime']) && $cfgvir['demime'] <> "") - fwrite($fd, "demime\n"); - - /* ================================================================ */ - /* == Tab: SPAM Settings == */ - /* ================================================================ */ - if (isset($cfgspam['checkspam']) && $cfgpam['checkspam'] <> "") { - fwrite($fd, "## SPAM Settings.\n"); - fwrite($fd, "checkspam\n"); - if (isset($cfgvir['spamcheck']) && $cfgvir['spamcheck'] <> "") - fwrite($fd, "spamcheck = {$cfgspam['spamcheck']}\n"); - else - fwrite($fd, "spamcheck = /usr/local/bin/dspam --user dspamuser --mode=teft --stdout --deliver=innocent,spam --feature=ch,no,wh\n"); - } - - fclose($fd); - - /* NOTE: The following code requires the p3scan.inc file to be saved with - UNIX Linefeeds. LF that is and NOT CR LF. - */ - $start = << "030.p3scan.sh", - "start" => $start, - "stop" => $stop - ) - ); - - conf_mount_ro(); - config_unlock(); - - if (! file_exists("/usr/local/etc/p3scan")) { - mkdir("/usr/local/etc/p3scan"); - } - if (! file_exists("/usr/local/etc/p3scan/p3scan.conf")) { - mwexec("ln -s /etc/p3scan.conf /usr/local/etc/p3scan/p3scan.conf"); - } - if (! file_exists("/usr/local/etc/p3scan/p3scan.mail")) { - $fd = fopen("/usr/local/etc/p3scan/p3scan.mail","w"); - - $p3scanmail = << - -EOD; - - fwrite($fd, $p3scanmail); - fclose($fd); - } - - mwexec("/usr/local/etc/rc.d/030.p3scan.sh stop"); - mwexec("/usr/local/etc/rc.d/030.p3scan.sh start"); - - return 0; -} - -function custom_php_install_command() { - global $config, $g; - sync_package_p3scan(); -} - -function custom_php_deinstall_command() { - global $config, $g; - conf_mount_rw(); - unlink_if_exists("/usr/local/pkg/pf/p3scan_rules.php"); - unlink_if_exists("/usr/local/www/p3scan_rules.php"); - unlink_if_exists("/usr/local/etc/p3scan/p3scan.conf"); - unlink_if_exists("/usr/local/etc/p3scan/p3scan.mail"); - unlink_if_exists("/usr/local/etc/rc.d/030.p3scan.sh"); - rmdir("/usr/local/etc/p3scan"); - conf_mount_ro(); -} -?> \ No newline at end of file diff --git a/packages/dspam/pkg/verdana.ttf b/packages/dspam/pkg/verdana.ttf deleted file mode 100644 index 754a9b7b..00000000 Binary files a/packages/dspam/pkg/verdana.ttf and /dev/null differ -- cgit v1.2.3