This file is indexed.

/usr/bin/faxq is in mgetty-fax 1.1.36-1.6.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
#!/bin/bash
#
# faxq program 
#
# like "lpq" or "mailq", show jobs waiting in the output queue
#
# SCCS: $Id: faxq.in,v 4.11 2005/04/16 11:29:09 gert Exp $ Copyright (C) 1994 Gert Doering
#
FAX_SPOOL=/var/spool/fax
FAX_SPOOL_OUT=/var/spool/fax/outgoing

#
# echo program that will accept escapes (bash: "echo -e", sun: /usr/5bin/echo)
#
echo="echo -e"

#
# an awk that is not stone-old-brain-dead (that is, not oawk...)
#
AWK=awk

#
# helper program for privileged queue access
FAXQ_HELPER=/usr/lib/mgetty-fax/faxq-helper

# ------------- subroutines -----------
do_faxq_stop()
{
    if [ ! -w . ]
    then
	$echo "$0: not administrator, can't stop queue" >&1 ; exit 0
    fi
    id >stop
}

do_faxq_start()
{
    if [ ! -w . ]
    then
	$echo "$0: not administrator, can't start queue" >&1 ; exit 0
    fi
    if [ ! -f stop  ]
    then
	$echo "$0: queue not stopped, can't restart" >&1 ; exit 0;
    fi
    rm -f stop
}
# -------------------------------------

if cd $FAX_SPOOL_OUT 
then :
else
    $echo "cannot chdir to $FAX_SPOOL_OUT..." >&2
    exit 1
fi

# special commands: faxq stop / start
case $1 in
    stop) do_faxq_stop ; exit 0;;
    start) do_faxq_start ; exit 0;;
    '') ;;
    -*) ;;
    *) cat <<EOF_MSG >&2
$0: invalid command: $1
valid commands:
  stop   stop fax queue handling (admin only)
  start  restart stopped fax queue (admin only)
EOF_MSG
       exit 1 ;;
esac

jobs="*/JOB"
requeue=""
changepri=""

while [ -n "$1" ]
do
    case $1 in
	-v) verbose="true" ;;
	-o) jobs="*/JOB.done" ;;
	-s) jobs="*/JOB.s*" ;;
	-a) jobs="*/JOB*" ;;
	-r) jobs="*/JOB.s*"; requeue="true" ;;
	-P) if [ -z "$2" -o -z "$3" ] ; then
		echo "$0: -P needs arguments!" >&2 ; exit 1 ;
	    fi
	    jobs="$2/JOB"; changepri="$3" ; shift ; shift
	    ;;
	*) cat <<EOF_MSG >&2
$0: invalid option: $flag
valid options:
  -o: show old jobs
  -s: show suspended jobs
  -a: show all jobs
  -v: verbose output
  -r: restart suspended jobs
  -P <job> <pri>: change priority of job <job> to <pri>
EOF_MSG
	   exit 1 ;;
    esac
    shift
done

jobs=`ls $jobs 2>/dev/null`
[ -z "$jobs" ] && $echo "no jobs."
for i in $jobs
do
    USER=""; PHONE=""; PAGES=""; MAILTO=""; VERBTO=""; 
    ACCT=""; INPUT=""; TIME=""; PRI=""; RE=""

    # read jobs using 'tr', remove all quote characters, dollar, and backslash
    if [ -z "$verbose" ]
    then
	eval `tr -d '\042\047\140\134\044\073' <$i | \
	     $AWK '$1=="user" { printf "USER=%s;", $2 }
		   $1=="phone" { printf "PHONE=%s;", $2 }
		   $1=="pages" { printf "PAGES=%d;", NF-1 }
		   $1=="priority" { printf "PRI=\" pri=%s.\";", $2}' -`
	$echo "$i: queued by $USER. $PAGES page(s) to $PHONE.$PRI"
    else
	eval `tr -d '\042\047\140\134\044\073' <$i | \
	     $AWK '$1=="user" { printf "USER=%s;", $2 }
		   $1=="mail"  { printf "MAILTO=\"%s\";", substr( $0, 6 ) }
		   $1=="phone" { printf "PHONE=%s;", $2 }
		   $1=="verbose_to" \
			       { printf "VERBTO=\"%s\";", substr( $0, 12 ) }
		   $1=="acct_handle" \
			       { printf "ACCT=\"%s\";", substr( $0, 13 ) }
		   $1=="input" { printf "INPUT=\"%s\";", substr( $0, 7 ) }
		   $1=="time"  { printf "TIME=\"%s:%s\";",
				 substr( $0, 6, 2 ), substr( $0, 8,2 ) }
		   $1=="subject"{ printf "RE=\"%s\";", substr( $0, 9 ) }
		   $1=="priority"{ printf "PRI=\"%s\";", $2 }
		   $1=="pages" { if ( NF==2 ) printf "PAGES=\"%s\";", $2
				 else if ( NF==3 )
                                     printf "PAGES=\"%s %s\";", $2, $3
				 else
                                     printf "PAGES=\"%s ... %s\";", $2, $NF
			       }' -`
	$echo "$i:"
	$echo "\tQueued by: $USER"
	$echo "\t       at: "`find $(dirname $i)/${PAGES%% *} -printf "%Ax %AH:%AM\n"`
       if [ -z "$VERBTO" ]
       then
	$echo "\t       to: $PHONE"
       else
	$echo "\t       to: $VERBTO ($PHONE)"
       fi
       test ! -z "$RE" && \
	$echo "\t       Re: $RE"
       test ! -z "$MAILTO" && \
	$echo "\t   E-Mail: $MAILTO"
       test ! -z "$INPUT" && \
	$echo "\t    Input: $INPUT"
	$echo "\t    Pages: $PAGES"
       test ! -z "$TIME" && \
	$echo "\tSend time: $TIME"
       test ! -z "$ACCT" && \
	$echo "\tAcct info: $ACCT"
       test ! -z "$PRI" && \
	$echo "\t Priority: $PRI"

	sed -e '/Status/!d' -e 's/Status/           Status:/' $i
       if [ -f "$i.locked" ] ; then
        $echo "\t   Status: LOCKED (being sent right now)"
       else
	expr $i : ".*done$" >/dev/null ||
	$echo "\t   Status: not sent yet"
       fi
    fi

# if "changepri", change priority of job
# TODO - this is currently broken, needs changing over to $FAXQ_HELPER
    if [ -n "$changepri" ] && expr "$i" : ".*JOB$" >/dev/null
    then
	d=`dirname $i`
	if [ ! -w $d ] ; then
	    $echo "$i: not owner, can't change priority"
	else
	    echo "priority $changepri" >>$i
	    $echo "Priority changed to $changepri"
	    touch .queue-changed 2>/dev/null
	fi
    fi

# if "requeue", requeue *.suspended-Jobs
    if [ -n "$requeue" ] && expr "$i" : ".*JOB.s" >/dev/null
    then
	d=`dirname $i`
	$FAXQ_HELPER requeue $d
    fi
done

test -n "$verbose" -a -n "$jobs" -a -r faxqueue_done &&
    $echo "\nLast \`\`faxrunq'' run at: `cat faxqueue_done`"

# queue stopped?  (print only if not "no jobs.")
test -n "$jobs" -a -f stop &&
    $echo "\nWarning: fax queue handling stopped (stop file exists).\n"