This file is indexed.

/usr/sbin/gspl-servinstall is in gnuspool 1.7.

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
#! /usr/bin/perl
#
#   Copyright 2010 Free Software Foundation, Inc.
#
#  This program is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.

use Socket;

$prefix = "/usr";
$exec_prefix = "/usr";
$bindir = "/usr/bin";
$sbindir = "/usr/sbin";

# Check and create service entries for GNUspool when running under Debian

# Services for GNUspool

#gnuspool		48100/tcp        # Connection port
#gnuspool		48100/udp        # Probe port
#gnuspool-feeder        48101/tcp        # Feeder port for GNUspool
#gnuspool-netsrv	48102/tcp        # External job submission
#gnuspool-netsrv	48102/udp        # Client access
#gnuspool-api		48103/tcp        # API
#gnuspool-api		48103/udp        # API (for wakeup messages)

#            Name                pnum  t/u    comment                     alternative names

@Portlist = ([gnuspool		=>	[48100, 'tcp', 'GNUspool connection port', [qw/xitext spshed spooler/]]],
	     [gnuspool		=>	[48100, 'udp', 'GNUspool probe port', [qw/xitext spshed spooler/]]],
	     ["gnuspool-feeder"	=>	[48101, 'tcp', 'GNUspool feeder port', [qw/spq/]]],
	     ["gnuspool-netsrv"	=>	[48102, 'tcp', 'GNUspool external job submission', [qw/xtnetsrv/]]],
	     ["gnuspool-netsrv"	=>	[48102, 'udp', 'GNUspool client access', [qw/xtnetsrv/]]],
	     ["gnuspool-api"	=>	[48103, 'tcp', 'GNUspool API', [qw/xtapi/]]],
	     ["gnuspool-api"	=>	[48103, 'udp', 'GNUspool API wakeup', [qw/xtapi/]]]);

# Make lookup for that lot

for my $p (@Portlist)  {
    my $name = $p->[0];
    my $dets = $p->[1];
    my $pnum = $dets->[0];
    my $istcp = $dets->[1] eq 'tcp';
    my @altnames = @{$dets->[3]};

    my $v = { NAME => $name, PORT => $pnum, LIST => $p, COMMENT => $dets->[2], ALIAS => \@altnames };

    if  ($istcp)  {
	$mtcpnames{$name} = $v;
	$mtcpports{$pnum} = $v;
	for my $a (@altnames) {
	    $mtcpnames{$a} = $v;
	}
    }
    else  {
	$mudpnames{$name} = $v;
	$mudpports{$pnum} = $v;
	for my $a (@altnames) {
	    $mudpnames{$a} = $v;
	}
    }
}

# Read in the services file

while (my ($name,$aliases,$port,$proto) = getservent)  {
    if  ((lc $proto) eq 'tcp')  {
	my $mp = $mtcpnames{$name};
	if  ($mp)  {
	    $mp->{HAD} = 1;
	    $had++;
	    push @tcpnconflict, {EXP => $mp, READ => $port} if $port != $mp->{PORT};
	}
	else  {
	    $mp = $mtcpports{$port};
	    push @tcppconflict, {EXP => $mp, READ => $name} if $mp;
	}
    }
    else  {
	my $mp = $mudpnames{$name};
	if  ($mp)  {
	    $mp->{HAD} = 1;
	    $had++;
	    push @udpnconflict, {EXP => $mp, READ => $port} if $port != $mp->{PORT};
	}
	else  {
	    $mp = $mudpports{$port};
	    push @udppconflict, {EXP => $mp, READ => $name} if $mp;
	}
    }
}
endservent;

# If we had any check we had all of them

if  ($had != 0)  {
    if  ($had != $#Portlist + 1)  {
	$errors++;
	print "Warning - service(s) are missing\n";
	for my $p (@Portlist)  {
	    my $name = $p->[0];
	    my $dets = $p->[1];
	    my $pnum = $dets->[0];
	    my $istcp = $dets->[1] eq 'tcp';
	    if  ($istcp)  {
		my $mp = $mtcpnames{$name};
		print "Tcp port $name\n" unless $mp->{HAD};
	    }
	    else  {
		my $mp = $mudpnames{$name};
		print "Udp port $name\n" unless $mp->{HAD};
	    }
	}
    }
}

if  (@tcpnconflict || @tcppconflict || @udpnconflict || @udppconflict)  {
    for my $c (@tcpnconflict)  {
	my $name = $c->{EXP}->{NAME};
	my $eport = $c->{EXP}->{PORT};
	my $rport = $c->{READ};
	print "Unexpected TCP port number $rport for $name expecting $eport\n";
	$errors++;
    }
    for my $c (@tcppconflict)  {
	my $name = $c->{EXP}->{NAME};
	my $eport = $c->{EXP}->{PORT};
	my $rname = $c->{READ};
	print "TCP port $eport in use by $rname expecting to use it for $name\n";
	$errors++;
    }
    for my $c (@udpnconflict)  {
	my $name = $c->{EXP}->{NAME};
	my $eport = $c->{EXP}->{PORT};
	my $rport = $c->{READ};
	print "Unexpected UDP port number $rport for $name expecting $eport\n";
	$errors++;
    }
    for my $c (@udppconflict)  {
	my $name = $c->{EXP}->{NAME};
	my $eport = $c->{EXP}->{PORT};
	my $rname = $c->{READ};
	print "UDP port $eport in use by $rname expecting to use it for $name\n";
	$errors++;
    }
}

if ($errors)  {
    print <<EOF;
Some services seem to conflict or be installed incompletely.
To avoid damaging your system setup this has been aborted.
Aborting due to $errors error(s)
EOF
    exit 10;
}

if ($had) {
    print <<EOF;
I think all your services are installed correctly and I don't need to
do anything, so I'll quit now.
EOF
    exit 0;
}

open(SRV, ">>/etc/services") or die "Cannot open services file\n";
print SRV "# GNUspool services\n";
for my $p (@Portlist)  {
    my $name = $p->[0];
    my $dets = $p->[1];
    my $pnum = $dets->[0];
    my $proto = $dets->[1];
    my $comment = $dets->[2];
    my @altnames = @{$dets->[3]};
    print SRV "$name\t$pnum/$proto ", join(' ', @altnames), " #$comment\n";
}
close SRV;

print <<EOF;
Services set up satisfactorily in /etc/services.
EOF
exit 0;