/usr/lib/yp/convert-ypserv-conf is in nis 3.17-32ubuntu6.
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 | #! /usr/bin/perl
#
# Convert the ypserv.conf file from the 1.3 format
# to the new 2.0 format.
#
# Version: @(#)convert-ypserv-conf 1.0 miquels@cistron.nl
#
$| = 1;
unless (open(FD, "<$ARGV[0]")) {
print STDERR "convert-ypserv-conf: $ARGV[0]: $!\n";
exit 1;
}
my @stat = stat FD;
my $old;
my $new;
while (<FD>) {
$old .= $_;
chomp;
s/^(#\s*Host\s*:)\s*Map\s*:\s*Security\s*:\s*Passwd_mangle\s*/$1 Domain : Map : Security/;
unless (/^(#?\s*\S+\s*):(\s*\S+\s*):(\s*(?:port|none|deny)\s*)(?::(\s*\S+\s*))?$/) {
$new .= "$_\n";
next;
}
my ($host, $map, $sec, $mangle) = ($1, $2, $3, $4);
if ($mangle =~ m/^\s*yes(:\d+)?/) {
my $port = $1;
$sec =~ s#(port|none)#$1/mangle$port#;
}
$new .= "$host: * :$map:$sec\n";
}
close FD;
exit 0 if ($old eq $new);
print "Converting version 1.3 ypserv.conf to 2.0...";
unless (open(FD, ">$ARGV[0].$$")) {
print STDERR "convert-ypserv-conf: $ARGV[0].$$: $!\n";
exit 1;
}
chown $stat[4], $stat[5], "$ARGV[0].$$";
chmod $stat[2], "$ARGV[0].$$";
print FD $new;
close FD;
unless (rename("$ARGV[0].$$", $ARGV[0])) {
print STDERR "convert-ypserv-conf: $ARGV[0].$$: $!\n";
unlink "$ARGV[0].$$";
exit 1;
}
print "done.\n";
exit 0;
|