This file is indexed.

/usr/sbin/autodns-dhcp_cron is in autodns-dhcp 0.9.

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
#!/usr/bin/perl -T

# this script checks is the current version of dhcpd.leases is more
# current than the version stored in DDNSHOME. If so, autodns-dhcp_ddns
# is called to create the ndupdate data file. Then nsupdate is called to
# notify BIND of the changes.

use strict;

require '/etc/autodns-dhcp.conf' ;
exit 0 if ($main::DOMAIN eq "__DOMAIN__") ;

# Untaint PATH
$ENV{PATH} = '';

my $UPDATE="$main::DDNSHOME/nsupdate.data";
my $DHCPUP="$main::DDNSHOME/dhcpd.conf.new";
my $DHCPDLEASES_TEMP="$main::DDNSHOME/dhcpd.leases.last";
my $LOCKFILE="$main::DDNSHOME/lock";
my $DHCPDCONF="$main::DHCPDCONF";
my $DHCPDPID="$main::DHCPDPID";
my $DHCPDINIT="$main::DHCPDINIT";
my $DDNS="/usr/sbin/autodns-dhcp_ddns";

my($ref,$data);
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks);

# get timestamp on leases file
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
 $blksize,$blocks)=stat($main::DHCPDLEASES);
$data=$mtime;

# get timestamp on saved file
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
 $blksize,$blocks)=stat($DHCPDLEASES_TEMP);
$ref=$mtime;

if ($ref >= $data) {
    exit 0;
}

# are we locked? (JIC :-)
if (-e "$LOCKFILE") {
    exit 0;
}

# ok lock us up
system "/bin/touch", $LOCKFILE;

$ENV{DDNSHOME}=$main::DDNSHOME;
$ENV{DHCPDLEASES}=$main::DHCPDLEASES;
$ENV{DHCPDCONF}=$main::DHCPDCONF;
$ENV{UPDATE}=$UPDATE;
$ENV{DHCPDLEASES_TEMP}=$DHCPDLEASES_TEMP;
$ENV{DNS_DOMAIN}=$main::DOMAIN;
$ENV{DHCPUP}=$DHCPUP;

# call autodns-dhcp_ddns
system "/usr/bin/perl", $DDNS;

($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
 $blksize,$blocks)=stat($UPDATE);

# now call nsupdate to notify BIND
if ( $size > 0  && ! system $main::NSUPDATE,$UPDATE) {
   ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
    $blksize,$blocks)=stat($DHCPUP);
   $data=$size;
   ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
    $blksize,$blocks)=stat($DHCPDCONF);
   if ($data > $size) {
      system "/bin/cp",$DHCPUP,$DHCPDCONF;
      $ENV{'PATH'} = '/sbin:/bin';
      system "/sbin/start-stop-daemon --stop --quiet --pidfile $DHCPDPID --retry 5 >/dev/null";
      system "$DHCPDINIT start >/dev/null";
   } else {
      print STDERR "$data $size";
      print STDERR "Error creating the new dhcpd configuration.\n";
   }
}

# unlock the process
system "/bin/rm", $LOCKFILE;