This file is indexed.

/usr/lib/news/bin/docheckgroups is in inn2 2.5.3-3ubuntu1.

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
#! /bin/bash
. /usr/lib/news/innshellvars

##  $Id: docheckgroups.in 9344 2011-08-16 14:33:18Z iulius $
##  Script to execute checkgroups text; results to stdout.
##
##  Usage: docheckgroups [-u] [include-pattern [exclude-pattern]] < message
##
##  If the -u flag is given, the newsgroups descriptions are automatically
##  updated.

T=${TMPDIR}
UPDATEDESC=false

cat /dev/null >${T}/$$out

##  Parse arguments.
if [ $# -gt 0 ]; then
    case $1 in
    -u) shift;
        UPDATEDESC=true;;
    esac
fi

##  Copy the message without excluded newsgroups and append local newsgroups.
cat | ${PERL} -e 'while (<STDIN>) { my @fields = split();
          print $_ if ((scalar(@fields) > 0) && ($fields[0] !~ /'${2:-^#}'/)
              && ($fields[0] !~ /^#/)); }' > ${T}/$$msg
test -f ${LOCALGROUPS} && cat ${LOCALGROUPS} | ${EGREP} -v "^#" >> ${T}/$$msg

##  Exit if there is no matching newsgroup (otherwise docheckgroups is eager
##  to delete everything).
test -s ${T}/$$msg || {
    rm -f ${T}/$$*
    exit 0
}

##  Make sure we do not have duplicates in the resulting concatenation of
##  the checkgroups and the localgroups file.
${SORT} -u ${T}/$$msg > ${T}/$$msg2
mv -f ${T}/$$msg2 ${T}/$$msg

##  Get the top-level newsgroup names from the message and turn it into
##  a regexp.
PATS=`${SED} <${T}/$$msg \
        -e 's/[ 	].*//' -e 's/\..*//' \
        -e 's/^!//' -e '/^$/d' \
        -e 's/^/^/' -e 's/$/[\.\w]/' \
    | ${SORT} -u \
    | (tr '\012' '|' ; echo '' ) \
    | ${SED} -e 's/|$//'`

##  Check for missing and obsolete newsgroups in active.
cat ${ACTIVE} | ${PERL} -e 'while (<STDIN>) { my @fields = split();
    print $fields[0]."\n" if ((scalar(@fields) > 0) && ($fields[0] =~ /'${1:-.}'/)
        && ($fields[0] =~ /'${PATS}'/)); }' | ${SORT} > ${T}/$$active
cat ${T}/$$msg | ${PERL} -e 'while (<STDIN>) { my @fields = split();
    print $fields[0]."\n" if ((scalar(@fields) > 0) && ($fields[0] =~ /'${1:-.}'/)
        && ($fields[0] =~ /'${PATS}'/)); }' | ${SORT} > ${T}/$$newsgrps

comm -13 ${T}/$$active ${T}/$$newsgrps >${T}/$$missing
comm -23 ${T}/$$active ${T}/$$newsgrps >${T}/$$remove

##  Check for proper moderation flags in active (we need to be careful
##  when dealing with wire-formatted articles manually fed from the spool).
cat ${ACTIVE} | ${PERL} -e 'while (<STDIN>) { my @fields = split();
    print $fields[0]."\n" if ((scalar(@fields) > 0) && ($fields[0] =~ /'${1:-.}'/)
        && ($fields[0] =~ /'${PATS}'/) && ($_ =~ / m$/)); }' | ${SORT} > ${T}/$$amod.all
cat ${T}/$$msg | ${PERL} -e 'while (<STDIN>) { my @fields = split();
    print $fields[0]."\n" if ((scalar(@fields) > 0) && ($fields[0] =~ /'${1:-.}'/)
        && ($fields[0] =~ /'${PATS}'/) && ($_ =~ / \(Moderated\)\r?$/)); }' \
    | ${SORT} > ${T}/$$ng.mod

comm -12 ${T}/$$missing ${T}/$$ng.mod >${T}/$$add.mod
comm -23 ${T}/$$missing ${T}/$$ng.mod >${T}/$$add.unmod
cat ${T}/$$add.mod ${T}/$$add.unmod >>${T}/$$add

comm -23 ${T}/$$amod.all ${T}/$$remove >${T}/$$amod
comm -13 ${T}/$$ng.mod ${T}/$$amod >${T}/$$ismod
comm -23 ${T}/$$ng.mod ${T}/$$amod >${T}/$$nm.all
comm -23 ${T}/$$nm.all ${T}/$$add >${T}/$$notmod

##  Check for missing and obsolete newsgroups descriptions (possibly
##  in wire format).  A few sed implementations do not recognize
##  "[	]\+", so we use "	[	]*" instead.
cat ${NEWSGROUPS} | ${PERL} -e 'while (<STDIN>) { my @fields = split();
    print $_ if ((scalar(@fields) > 0) && ($fields[0] =~ /'${1:-.}'/)
        && ($fields[0] =~ /'${PATS}'/)); }' \
    | ${SED} 's/	[	]*/	/' | ${SORT} > ${T}/$$localdesc
cat ${T}/$$msg | ${PERL} -e 'while (<STDIN>) { my @fields = split();
    print $_ if ((scalar(@fields) > 0) && ($fields[0] =~ /'${1:-.}'/)
        && ($fields[0] =~ /'${PATS}'/)); }' \
    | ${SED} 's/\r\?$//' \
    | ${SED} 's/	[	]*/	/' | ${SORT} > ${T}/$$newdesc

comm -13 ${T}/$$localdesc ${T}/$$newdesc >${T}/$$missingdesc
comm -23 ${T}/$$localdesc ${T}/$$newdesc >${T}/$$removedesc

##  If the -u flag is given, update the newsgroups descriptions.
if [ "${UPDATEDESC}" = "true" ] ; then
    cat ${NEWSGROUPS} | ${PERL} -e 'while (<STDIN>) { my @fields = split();
        print $_ if ((scalar(@fields) > 0) && ($fields[0] !~ /'${PATS}'/)); }' \
        > ${T}/$$updatednewsgroups
    cat ${NEWSGROUPS} | ${PERL} -e 'while (<STDIN>) { my @fields = split();
        print $_ if ((scalar(@fields) > 0) && ($fields[0] !~ /'${1:-.}'/)
        && ($fields[0] =~ /'${PATS}'/)); }' \
        >> ${T}/$$updatednewsgroups
    cat ${T}/$$newdesc >>${T}/$$updatednewsgroups
    mv -f ${NEWSGROUPS} ${NEWSGROUPS}.old
    ${SORT} ${T}/$$updatednewsgroups | ${SED} 's/	[	]*/	/' \
        | ${PERL} -e 'while (<STDIN>) { my @fields = split("\t", $_, 2);
            next if (scalar(@fields) == 0);
            my $length = length("$fields[0]");
            my $desc;
            if (scalar(@fields) == 2) { $desc = "$fields[1]"; } else { $desc = ""; }
            if ($length < 8) { print $fields[0]."\t\t\t".$desc; }
            elsif ($length < 16) { print $fields[0]."\t\t".$desc; }
            else { print $fields[0]."\t".$desc; } }' > ${NEWSGROUPS}
    chmod 0664 ${NEWSGROUPS} ${NEWSGROUPS}.old
fi

##  Display information on newsgroups which need to be removed/added/changed.
if [ -s ${T}/$$remove ] ; then
    (
        echo "# The following newsgroups are non-standard and should be removed:"
        echo "#"
        ${SED} "s/^/#	/" ${T}/$$remove
        echo "#"
        echo "# You can remove them by executing the command(s):"
        echo ""
        for i in `cat ${T}/$$remove` ; do
            echo "	${PATHBIN}/ctlinnd rmgroup $i"
        done
        echo ""
    ) >>${T}/$$out
fi

if [ -s ${T}/$$add ] ; then
    (
        echo "# The following newsgroups are missing and should be added:"
        echo "#"
        ${SED} "s/^/#	/" ${T}/$$add
        echo "#"
        echo "# You can add them by executing the command(s):"
        echo ""
        for i in `cat ${T}/$$add.unmod` ; do
            echo "	${PATHBIN}/ctlinnd newgroup $i y ${FROM}"
        done
        for i in `cat ${T}/$$add.mod` ; do
            echo "	${PATHBIN}/ctlinnd newgroup $i m ${FROM}"
        done
        echo ""
    ) >>${T}/$$out
fi

if [ -s ${T}/$$ismod ] ; then
    (
        echo "# The following newsgroups are incorrectly marked as moderated"
        echo "# and should have their status changed:"
        echo "#"
        ${SED} "s/^/#	/" ${T}/$$ismod
        echo "#"
        echo "# You can correct this by executing the command(s):"
        echo ""
        for i in `cat ${T}/$$ismod` ; do
            echo "	${PATHBIN}/ctlinnd changegroup $i y"
        done
        echo ""
    ) >>${T}/$$out
fi

if [ -s ${T}/$$notmod ] ; then
    (
        echo "# The following newsgroups are incorrectly marked as unmoderated"
        echo "# and should have their status changed:"
        echo "#"
        ${SED} "s/^/#	/" ${T}/$$notmod
        echo "#"
        echo "# You can correct this by executing the command(s):"
        echo ""
        for i in `cat ${T}/$$notmod` ; do
            echo "	${PATHBIN}/ctlinnd changegroup $i m"
        done
        echo ""
    ) >>${T}/$$out
fi

##  Display information on descriptions which need to be removed/added.
if [ -s ${T}/$$removedesc ] ; then
    (
        echo "# The following newsgroups descriptions are obsolete and should be removed:"
        echo "#"
        ${SED} "s/^/#	/" ${T}/$$removedesc
        echo "#"
        if [ "${UPDATEDESC}" = "true" ] ; then
            echo "# The file ${NEWSGROUPS} has just been updated accordingly."
        else
            echo "# You can remove them by editing ${NEWSGROUPS}"
            echo "# or by using the -u flag with docheckgroups."
        fi
        echo ""
    ) >>${T}/$$out
fi

if [ -s ${T}/$$missingdesc ] ; then
    (
        echo "# The following newsgroups descriptions are missing and should be added:"
        echo "#"
        ${SED} "s/^/#	/" ${T}/$$missingdesc
        echo "#"
        if [ "${UPDATEDESC}" = "true" ] ; then
            echo "# The file ${NEWSGROUPS} has just been updated accordingly."
        else
            echo "# You can add them by editing ${NEWSGROUPS}"
            echo "# or by using the -u flag with docheckgroups."
        fi
        echo ""
    ) >>${T}/$$out
fi

##  We're done.
test -s ${T}/$$out && {
    cat ${T}/$$out
    echo "exit # so you can feed this message into the shell (as well as mod-active)."
    echo ""
}

rm -f ${T}/$$*