Lines 776-795
Link Here
|
776 |
my $content = ''; |
776 |
my $content = ''; |
777 |
|
777 |
|
778 |
local *FD; |
778 |
local *FD; |
779 |
if (! open(FD, "< $file")) { |
779 |
if (! open(FD, "< $file")) { fatal("Cannot open file '%s'. ($!)", $file); } |
780 |
# fatal("Cannot open file '%s'. ($!)", $file); |
|
|
781 |
warning("Cannot open file '%s'. ($!)", $file); |
782 |
} |
783 |
# Check for only owner has any access to config file |
780 |
# Check for only owner has any access to config file |
784 |
my ($dev, $ino, $mode, @statrest) = stat(FD); |
781 |
my $badperm = 0; |
785 |
if ($mode & 077) { |
782 |
my @stats = stat(FD); |
786 |
if (-f FD && (chmod 0600, $file)) { |
783 |
my $perms = $stats[2] & 07777; |
787 |
warning("file $file must be accessible only by its owner (fixed)."); |
784 |
my $oct_perms = sprintf "%lo", $perms; |
788 |
} else { |
785 |
my $uid = $stats[4]; |
789 |
# fatal("file $file must be accessible only by its owner."); |
786 |
my $uname = getpwuid($uid); |
790 |
warning("file $file must be accessible only by its owner."); |
787 |
my $gid = $stats[5]; |
791 |
} |
788 |
my $grnam = getgrgid($gid); |
792 |
} |
789 |
if ($uid != getpwnam("root")) { |
|
|
790 |
$badperm = 1; |
791 |
warning("Root should own $file, but $uname owns it!"); |
792 |
} |
793 |
if ($gid != getgrnam("ddclient")) { |
794 |
$badperm = 1; |
795 |
warning("Group ddclient should own $file, but group $grnam owns it!"); |
796 |
} |
797 |
if ($perms != 0640) { |
798 |
$badperm = 1; |
799 |
warning("$file has permissions $oct_perms, but should have permissions 0640."); |
800 |
} |
801 |
# if ($badperm) { |
802 |
# fatal("Please correct the permissions on $file and restart ddclient. Exiting.") |
803 |
# } |
793 |
|
804 |
|
794 |
local $lineno = 0; |
805 |
local $lineno = 0; |
795 |
my $continuation = ''; |
806 |
my $continuation = ''; |