This file is indexed.

/usr/lib/news/bin/scanlogs is in inn 1:1.7.2q-45build2.

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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
#! /bin/sh
##  $Revision: 1.31 $
##  Summarize INN log files.
##  Optional arguments:
##	norotate	Do not rotate logfiles

##  =()<. @<_PATH_SHELLVARS>@>()=
. /usr/lib/news/innshellvars

##  If you get an error from this line:
##	sh -c 'egrep "`ls /etc`" /dev/null'
##  then get a better egrep, like the FSF one.

##  Directory where old log files are kept.
OLD=${MOST_LOGS}/OLD
##  If you want to archive the active file, enable this line.
ACTIVEFILE=${ACTIVE}
##  Number of lines of error in each category to report.
TOP=${TOP-20}
##  NN log file.
NN=${NEWSLIB}/nn/Log
##  Where nntpsend, if used, writes its log information.
NNTPSEND=${MOST_LOGS}/nntpsend.log
##  Where news.daily places expire output, unless noexplog was used.
EXPLOG=${MOST_LOGS}/expire.log

##  If you divide your news syslog into separate files, list them here.
SYSLOG_CRIT=${MOST_LOGS}/news.crit
SYSLOG_ERR=${MOST_LOGS}/news.err
SYSLOG_NOTICE=${MOST_LOGS}/news.notice
SYSLOGS="${SYSLOG_CRIT} ${SYSLOG_ERR} ${SYSLOG_NOTICE}"

##  Where tally control and unwanted processors are found.
TALLY_CONTROL=${NEWSBIN}/tally.control
TALLY_UNWANTED=${NEWSBIN}/tally.unwanted
UNWANTED_LOG=${MOST_LOGS}/unwanted.log
CONTROL_LOG=${MOST_LOGS}/control.log
CONTROL_DATA=
test -f ${MOST_LOGS}/newgroup.log && CONTROL_DATA=${MOST_LOGS}/newgroup.log
test -f ${MOST_LOGS}/rmgroup.log \
	&& CONTROL_DATA="${CONTROL_DATA} ${MOST_LOGS}/rmgroup.log"

##  Build up the list of log files to process.
LOGS="${ERRLOG} ${EXPLOG} ${LOG} ${ACTIVEFILE} ${SYSLOGS} ${UNWANTED_LOG}"

test -n "${NNTPSEND}" -a -f "${NNTPSEND}" && LOGS="${LOGS} ${NNTPSEND}"
test -n "${CONTROL_DATA}" && LOGS="${LOGS} ${CONTROL_LOG}"
for F in checkgroups default ihave newgroup rmgroup sendme sendsys \
	senduuname version miscctl badcontrol failedpgp badpgp; do
    test -f ${MOST_LOGS}/${F}.log && LOGS="${LOGS} ${MOST_LOGS}/${F}.log"
done

PROGNAME=scanlogs
LOCK=${LOCKS}/LOCK.${PROGNAME}

##  Set defaults.
ROTATE=true

##  Parse JCL.
for I
do
    case "X${I}" in
    Xnonn)
	# Ignore this.
	;;
    Xnorotate)
	ROTATE=false
	;;
    *)
	echo "Unknown flag ${I}" 1>&2
	exit 1
	;;
    esac
done

##  Make sure every log exists.
for F in ${LOGS} ; do
    test ! -f ${F} && touch ${F}
done

##  Temporary files.
T=${TMPDIR}/scan$$
PROBS=${TMPDIR}/scanlog$$
trap "rm -f ${T} ${PROBS}; exit 0" 0 1 2 3 15

##  Rotate the logs?
if ${ROTATE} ; then
    ##  Lock out others.
    shlock -p $$ -f ${LOCK} || {
	echo "$0: Locked by `cat ${LOCK}`"
	exit 1
    }
    trap "rm -f ${T} ${PROBS} ${LOCK}; exit 0" 1 2 3 15

    HERE=`pwd`
    cd ${MOST_LOGS}

    ctlinnd -s logmode
    PAUSED=false
    ctlinnd -s pause "Flushing log and syslog files" 2>&1 && PAUSED=true
    ctlinnd -s flushlogs 2>&1 || {
	echo 'Cannot flush logs.'
	rm -f ${LOCK}
	exit 1
    }

    ##  Make sure these .old files exist, in case innd is down.
    for F in ${LOG} ${ERRLOG} ${EXPLOG} ; do
	if [ ! -f ${F}.old ]; then
	    rm -f ${F}.old
	    cp ${F} ${F}.old
	    cat /dev/null >${F}
	fi
    done

    ##  Copy syslog files, truncating old inode since syslog has it open.
    for F in ${SYSLOGS}; do
	rm -f ${F}.old
	cp ${F} ${F}.old
	cat /dev/null >${F}
    done
    ctlinnd -s logmode

    ##  Make a copy of the active file.
    if [ -n ${ACTIVEFILE} ] ; then
	BASE=`basename ${ACTIVEFILE}`
	rm -f ${OLD}/${BASE}.old
	cp ${ACTIVEFILE} ${OLD}/${BASE}.old
    fi

    ##  These are live files, so use link rather than copy.
    for F in ${NNTPSEND} ; do
	if [ -f ${F} ]; then
	    rm -f ${F}.old ${F}.new
	    ln ${F} ${F}.old
	    touch ${F}.new
	    chmod 0660 ${F}.new
	    mv ${F}.new ${F}
	fi
    done

    ##  Tally control messages if we logged them.
    test -n "${CONTROL_DATA}" && cat ${CONTROL_DATA} | ${TALLY_CONTROL}
    ${TALLY_UNWANTED} <${LOG}.old

    ${PAUSED} && ctlinnd -s go "Flushing log and syslog files" 2>&1

    cd ${OLD}
    for F in ${LOGS}; do
	##  Process the current (just-flushed) log
	BASE=`basename ${F}`
	rm -f ${OLD}/${BASE}
	case ${F} in
	${SYSLOG_CRIT}|${ERRLOG}|${EXPLOG}|${LOG}|${SYSLOG_NOTICE})
	    ##  Make a link that can be deleted (since if not rotating
	    ##  we delete the copy that is made in ${TMPDIR}).
	    mv ${F}.old ${OLD}/${BASE}
	    rm -f ${OLD}/${BASE}.0
	    ln ${OLD}/${BASE} ${OLD}/${BASE}.0
	    ;;
	${ACTIVEFILE})
	    mv ${BASE}.old ${OLD}/${BASE}
	    ;;
	${SYSLOG_ERR})
	    mv ${F}.old ${OLD}/${BASE}
	    ;;
	*)
	    if [ -f ${F}.old ]; then
		mv ${F}.old ${OLD}/${BASE}
	    else
		rm -f ${OLD}/${BASE} ${F}.new
		touch ${F}.new
		chmod 0660 ${F}.new
		ln ${F} ${OLD}/${BASE}
		mv ${F}.new ${F}
	    fi
	    ;;
	esac
    done
    cd ${HERE}

    ##  Truncate logs from send-nntp and/or send-uucp.
    if [ -s ${MOST_LOGS}/send-nntp.log ] ; then
	${COMPRESS} <${MOST_LOGS}/send-nntp.log >${OLD}/send-nntp.1${Z}
	cat /dev/null >${MOST_LOGS}/send-nntp.log
    fi
    if [ -s ${MOST_LOGS}/send-uucp.log ] ; then
	${COMPRESS} <${MOST_LOGS}/send-uucp.log >${OLD}/send-uucp.1${Z}
	cat /dev/null >${MOST_LOGS}/send-uucp.log
    fi
else
    ##  Don't use the real OLD directory, instead use TMPDIR
    OLD=${TMPDIR}

    ##  Make a snapshot of what we need for below.
    ctlinnd -s pause "Snapshot log and syslog files" 2>&1
    for F in ${SYSLOG_CRIT} ${ERRLOG} ${EXPLOG} ${LOG} ${SYSLOG_NOTICE} ; do
	BASE=`basename ${F}`
	rm -f ${OLD}/${BASE}.0
	cp ${F} ${OLD}/${BASE}.0
    done
    ctlinnd -s go "Snapshot log and syslog files" 2>&1
fi

##
##  We now (finally!) have copies of the log files where we need them.
##

##  Display syslog critical messages.
BASE=`basename ${SYSLOG_CRIT}`
OLD_SYSLOG=${OLD}/${BASE}.0
if [ -s ${OLD_SYSLOG} ] ; then
    echo Syslog critical messages:
    cat ${OLD_SYSLOG}
    echo ---------
    echo ''
fi
rm -f ${OLD_SYSLOG}

##  Display error log.
BASE=`basename ${ERRLOG}`
OLD_ERRLOG=${OLD}/${BASE}.0
if [ -s ${OLD_ERRLOG} ] ; then
    echo Error log:
    cat ${OLD_ERRLOG}
    echo ---------
    echo ''
fi
rm -f ${OLD_ERRLOG}

##  Display expire log messages
BASE=`basename ${EXPLOG}`
OLD_EXPLOG=${OLD}/${BASE}.0
if [ -s ${OLD_EXPLOG} ] ; then
    echo Expire messages:
    cat ${OLD_EXPLOG}
    echo ---------
    echo ''
fi
rm -f ${OLD_EXPLOG}

##  Scan for various problems in articles we were offered or sent.
BASE=`basename ${LOG}`
OLD_LOG=${OLD}/${BASE}.0

##  Summarize syslog information
BASE=`basename ${SYSLOG_NOTICE}`
OLD_SYSLOG=${OLD}/${BASE}.0
if [ -s ${OLD_SYSLOG} ] ; then
    echo Syslog summary:
    /usr/lib/news/bin/innreport -f /etc/news/innreport.conf ${OLD_SYSLOG} ${OLD_LOG}
    echo ---------
    echo ''
fi
rm -f ${OLD_LOG} ${OLD_SYSLOG}

##  Compress and rotate the logs.
if ${ROTATE} ; then
    cd ${OLD}
    for F in ${LOGS} ; do
	##  Skip if file doesn't exist.
	BASE=`basename ${F}`
	test -f ${BASE} || continue

	##  Compress the file.
	${COMPRESS} <${BASE} >${BASE}.0${Z} && rm -f ${BASE}
	chmod 0440 ${BASE}.0${Z}

	##  Do rotation.
	EXT=${CYCLES}
	rm -f ${BASE}.${CYCLES}${Z}
	while [ ${EXT} -gt 0 ] ; do
	    NEXT=${EXT}
	    EXT=`expr ${EXT} - 1`
	    test -f ${BASE}.${EXT}${Z} \
		&& rm -f ${BASE}.${NEXT}${Z} \
		&& mv ${BASE}.${EXT}${Z} ${BASE}.${NEXT}${Z}
	done
    done

    ##  Remove lock.
    rm -f ${LOCK}
fi

##  All done.
exit 0