summaryrefslogtreecommitdiff
path: root/security/antivir-milter/files/patch-script::avq
blob: cc77b108e70c380780e3b3ff2027ce1e745ddee5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
--- script/avq.orig	Sat Oct 11 13:26:02 2003
+++ script/avq	Sat Oct 11 13:31:54 2003
@@ -39,7 +39,7 @@
 #   59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #******************************************************************************
 
-configuration=/etc/avmilter.conf
+configuration=%%PREFIX%%/etc/avmilter/avmilter.conf
 
 for arg ;
 do
@@ -68,6 +68,15 @@
 systeme="`uname`"
 date_param="-d"
 
+# Make sure the user running this program is root or the avmilter user.
+procowner=${procowner:-`/usr/bin/id -u`}
+user="`egrep -i '^user' $configuration | awk '{print $2;}'`"
+uid="`/usr/bin/id -u "$user"`"
+if [ "$procowner" != "0" -a "$procowner" != "$uid" ]; then
+	echo "${pname}: you must be root (uid 0) or the avmilter user to run this utility."
+	exit 2
+fi
+
 usage() {
     echo "${pname} usage:"
     echo "    ${pname} [--conf=.conf] "
@@ -149,7 +158,7 @@
         data=`/bin/ls "${queue}"/*/[Dd]f-"${id}"`
        echo "ctor: ${ctrl} ${data}" 
         if [ ! -f "${data}" ] ; then
-            echo "${pname}: there is no data  file id '${id}'"\
+            echo "${pname}: there is no data file id '${id}'"\
                  "in queue '$queue'."
             exit 3            
         fi
@@ -161,9 +170,13 @@
         bnam="`basename ${ctrl}`"
         case $newstate in
         R)
-            ( /bin/rm "${ctrl}" && /bin/rm "${data}" ) \
-            && echo "${pname}: message id '${id}' removed." \
-            || echo "${pname}: could not remove message id '${id}'."
+            if ( /bin/rm "${ctrl}" && /bin/rm "${data}" ) > /dev/null 2>&1 ; then
+                    echo "${pname}: message id '${id}' removed."
+                    exit 0
+                else
+                    echo "${pname}: could not remove message id '${id}'."
+                    exit 3
+                fi
             ;;
         *)
             Qtrl="`echo $bnam|sed -e 's/^.\(.*\)$/'${newstate}'\1/'`"
@@ -204,7 +217,7 @@
             group=`egrep -i '^group' "$configuration"|awk '{print $2;}'`
             if [ -f "${data}" ] ; then
                 if /bin/ls "${queue}"/*/??-"${id}" > /dev/null 2>&1 ; then
-                    echo "${pname}: there is already files with id '${id}'"
+                    echo "${pname}: there are already files with id '${id}'"
                     echo "${pblan}  in queue '${queue}'."
                     exit 3
                 else